From 00261d46397da61b424cd0e3d94d6bad96092836 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 25 Aug 2021 12:58:23 +0000 Subject: [PATCH] feat: add `GetDataRetentionSettings`, `UpdateDataRetentionSettings` methods to the API (#119) - [ ] Regenerate this pull request now. PiperOrigin-RevId: 392540180 Source-Link: https://github.com/googleapis/googleapis/commit/9e617db5033d24bb8a47d6ac0d48de33b6f9ab16 Source-Link: https://github.com/googleapis/googleapis-gen/commit/61da03bd21c6e7ccff75acbcb293ddb601b42818 feat: add `GetDisplayVideo360AdvertiserLink`, `ListDisplayVideo360AdvertiserLinks` methods to the API feat: add `CreateDisplayVideo360AdvertiserLink`, `DeleteDisplayVideo360AdvertiserLink` methods to the API feat: add `GetDisplayVideo360AdvertiserLinkProposal`, `ListDisplayVideo360AdvertiserLinkProposals` methods to the API feat: add `DeleteDisplayVideo360AdvertiserLinkProposal` method to the API feat: add `CancelDisplayVideo360AdvertiserLinkProposal` method to the API feat: add `LinkProposalStatusDetails`, `DisplayVideo360AdvertiserLinkProposal` types to the API feat: add `DisplayVideo360AdvertiserLink`, `LinkProposalState` types to the API feat: add `LinkProposalInitiatingProduct`, `ServiceLevel`, `DataRetentionSettings` types to the API feat: add `service_level` field to `Property` type feat: add `display_video_360_advertiser_link` fields to `ChangeHistoryChange.resource` oneof field. feat: add `display_video_360_advertiser_link_proposal` fields to `ChangeHistoryChange.resource` oneof field. feat: add `data_retention_settings` fields to `ChangeHistoryChange.resource` oneof field. feat: add `custom` output only field to `ConversionEvent` type feat: change `measurement_unit` field to mutable in `CustomMetric` type fix: remove `UpdateFirebaseLink` method from the API fix: rename `is_deletable` field of `ConversionEvent` type to `deletable` fix: rename `email_address` field of `GoogleAdsLink` type to `creator_email_address` fix: remove `maximum_user_access` field from `FirebaseLink` type fix: remove `MaximumUserAccess` enum from the API --- .../google/analytics/admin/__init__.py | 84 +- .../analytics/admin_v1alpha/__init__.py | 50 +- .../admin_v1alpha/gapic_metadata.json | 136 +- .../analytics_admin_service/async_client.py | 1355 +++- .../analytics_admin_service/client.py | 1412 +++- .../analytics_admin_service/pagers.py | 287 + .../transports/base.py | 231 +- .../transports/grpc.py | 458 +- .../transports/grpc_asyncio.py | 461 +- .../analytics/admin_v1alpha/types/__init__.py | 50 +- .../admin_v1alpha/types/analytics_admin.py | 326 +- .../admin_v1alpha/types/resources.py | 283 +- .../scripts/fixup_admin_v1alpha_keywords.py | 14 +- .../test_analytics_admin_service.py | 6107 +++++++++++++---- 14 files changed, 9353 insertions(+), 1901 deletions(-) diff --git a/packages/google-analytics-admin/google/analytics/admin/__init__.py b/packages/google-analytics-admin/google/analytics/admin/__init__.py index 5442bf41ec66..6cf96e884398 100644 --- a/packages/google-analytics-admin/google/analytics/admin/__init__.py +++ b/packages/google-analytics-admin/google/analytics/admin/__init__.py @@ -21,6 +21,12 @@ AnalyticsAdminServiceAsyncClient, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ApproveDisplayVideo360AdvertiserLinkProposalRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ApproveDisplayVideo360AdvertiserLinkProposalResponse, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( ArchiveCustomDimensionRequest, ) @@ -50,6 +56,9 @@ from google.analytics.admin_v1alpha.types.analytics_admin import ( BatchUpdateUserLinksResponse, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + CancelDisplayVideo360AdvertiserLinkProposalRequest, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( CreateConversionEventRequest, ) @@ -59,6 +68,12 @@ from google.analytics.admin_v1alpha.types.analytics_admin import ( CreateCustomMetricRequest, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + CreateDisplayVideo360AdvertiserLinkProposalRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + CreateDisplayVideo360AdvertiserLinkRequest, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( CreateFirebaseLinkRequest, ) @@ -80,6 +95,12 @@ from google.analytics.admin_v1alpha.types.analytics_admin import ( DeleteConversionEventRequest, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + DeleteDisplayVideo360AdvertiserLinkProposalRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + DeleteDisplayVideo360AdvertiserLinkRequest, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( DeleteFirebaseLinkRequest, ) @@ -108,9 +129,18 @@ GetCustomDimensionRequest, ) from google.analytics.admin_v1alpha.types.analytics_admin import GetCustomMetricRequest +from google.analytics.admin_v1alpha.types.analytics_admin import ( + GetDataRetentionSettingsRequest, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( GetDataSharingSettingsRequest, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + GetDisplayVideo360AdvertiserLinkProposalRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + GetDisplayVideo360AdvertiserLinkRequest, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( GetEnhancedMeasurementSettingsRequest, ) @@ -159,6 +189,18 @@ from google.analytics.admin_v1alpha.types.analytics_admin import ( ListCustomMetricsResponse, ) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ListDisplayVideo360AdvertiserLinkProposalsRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ListDisplayVideo360AdvertiserLinkProposalsResponse, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ListDisplayVideo360AdvertiserLinksRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + ListDisplayVideo360AdvertiserLinksResponse, +) from google.analytics.admin_v1alpha.types.analytics_admin import ( ListFirebaseLinksRequest, ) @@ -216,10 +258,13 @@ UpdateCustomMetricRequest, ) from google.analytics.admin_v1alpha.types.analytics_admin import ( - UpdateEnhancedMeasurementSettingsRequest, + UpdateDataRetentionSettingsRequest, ) from google.analytics.admin_v1alpha.types.analytics_admin import ( - UpdateFirebaseLinkRequest, + UpdateDisplayVideo360AdvertiserLinkRequest, +) +from google.analytics.admin_v1alpha.types.analytics_admin import ( + UpdateEnhancedMeasurementSettingsRequest, ) from google.analytics.admin_v1alpha.types.analytics_admin import ( UpdateGoogleAdsLinkRequest, @@ -247,13 +292,19 @@ from google.analytics.admin_v1alpha.types.resources import ConversionEvent from google.analytics.admin_v1alpha.types.resources import CustomDimension from google.analytics.admin_v1alpha.types.resources import CustomMetric +from google.analytics.admin_v1alpha.types.resources import DataRetentionSettings from google.analytics.admin_v1alpha.types.resources import DataSharingSettings +from google.analytics.admin_v1alpha.types.resources import DisplayVideo360AdvertiserLink +from google.analytics.admin_v1alpha.types.resources import ( + DisplayVideo360AdvertiserLinkProposal, +) from google.analytics.admin_v1alpha.types.resources import EnhancedMeasurementSettings from google.analytics.admin_v1alpha.types.resources import FirebaseLink from google.analytics.admin_v1alpha.types.resources import GlobalSiteTag from google.analytics.admin_v1alpha.types.resources import GoogleAdsLink from google.analytics.admin_v1alpha.types.resources import GoogleSignalsSettings from google.analytics.admin_v1alpha.types.resources import IosAppDataStream +from google.analytics.admin_v1alpha.types.resources import LinkProposalStatusDetails from google.analytics.admin_v1alpha.types.resources import MeasurementProtocolSecret from google.analytics.admin_v1alpha.types.resources import Property from google.analytics.admin_v1alpha.types.resources import PropertySummary @@ -265,11 +316,15 @@ from google.analytics.admin_v1alpha.types.resources import GoogleSignalsConsent from google.analytics.admin_v1alpha.types.resources import GoogleSignalsState from google.analytics.admin_v1alpha.types.resources import IndustryCategory -from google.analytics.admin_v1alpha.types.resources import MaximumUserAccess +from google.analytics.admin_v1alpha.types.resources import LinkProposalInitiatingProduct +from google.analytics.admin_v1alpha.types.resources import LinkProposalState +from google.analytics.admin_v1alpha.types.resources import ServiceLevel __all__ = ( "AnalyticsAdminServiceClient", "AnalyticsAdminServiceAsyncClient", + "ApproveDisplayVideo360AdvertiserLinkProposalRequest", + "ApproveDisplayVideo360AdvertiserLinkProposalResponse", "ArchiveCustomDimensionRequest", "ArchiveCustomMetricRequest", "AuditUserLinksRequest", @@ -281,9 +336,12 @@ "BatchGetUserLinksResponse", "BatchUpdateUserLinksRequest", "BatchUpdateUserLinksResponse", + "CancelDisplayVideo360AdvertiserLinkProposalRequest", "CreateConversionEventRequest", "CreateCustomDimensionRequest", "CreateCustomMetricRequest", + "CreateDisplayVideo360AdvertiserLinkProposalRequest", + "CreateDisplayVideo360AdvertiserLinkRequest", "CreateFirebaseLinkRequest", "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", @@ -293,6 +351,8 @@ "DeleteAccountRequest", "DeleteAndroidAppDataStreamRequest", "DeleteConversionEventRequest", + "DeleteDisplayVideo360AdvertiserLinkProposalRequest", + "DeleteDisplayVideo360AdvertiserLinkRequest", "DeleteFirebaseLinkRequest", "DeleteGoogleAdsLinkRequest", "DeleteIosAppDataStreamRequest", @@ -305,7 +365,10 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", + "GetDisplayVideo360AdvertiserLinkProposalRequest", + "GetDisplayVideo360AdvertiserLinkRequest", "GetEnhancedMeasurementSettingsRequest", "GetGlobalSiteTagRequest", "GetGoogleSignalsSettingsRequest", @@ -326,6 +389,10 @@ "ListCustomDimensionsResponse", "ListCustomMetricsRequest", "ListCustomMetricsResponse", + "ListDisplayVideo360AdvertiserLinkProposalsRequest", + "ListDisplayVideo360AdvertiserLinkProposalsResponse", + "ListDisplayVideo360AdvertiserLinksRequest", + "ListDisplayVideo360AdvertiserLinksResponse", "ListFirebaseLinksRequest", "ListFirebaseLinksResponse", "ListGoogleAdsLinksRequest", @@ -348,8 +415,9 @@ "UpdateAndroidAppDataStreamRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRetentionSettingsRequest", + "UpdateDisplayVideo360AdvertiserLinkRequest", "UpdateEnhancedMeasurementSettingsRequest", - "UpdateFirebaseLinkRequest", "UpdateGoogleAdsLinkRequest", "UpdateGoogleSignalsSettingsRequest", "UpdateIosAppDataStreamRequest", @@ -366,13 +434,17 @@ "ConversionEvent", "CustomDimension", "CustomMetric", + "DataRetentionSettings", "DataSharingSettings", + "DisplayVideo360AdvertiserLink", + "DisplayVideo360AdvertiserLinkProposal", "EnhancedMeasurementSettings", "FirebaseLink", "GlobalSiteTag", "GoogleAdsLink", "GoogleSignalsSettings", "IosAppDataStream", + "LinkProposalStatusDetails", "MeasurementProtocolSecret", "Property", "PropertySummary", @@ -384,5 +456,7 @@ "GoogleSignalsConsent", "GoogleSignalsState", "IndustryCategory", - "MaximumUserAccess", + "LinkProposalInitiatingProduct", + "LinkProposalState", + "ServiceLevel", ) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/__init__.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/__init__.py index a758c678b045..96beb0a17822 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/__init__.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/__init__.py @@ -17,6 +17,8 @@ from .services.analytics_admin_service import AnalyticsAdminServiceClient from .services.analytics_admin_service import AnalyticsAdminServiceAsyncClient +from .types.analytics_admin import ApproveDisplayVideo360AdvertiserLinkProposalRequest +from .types.analytics_admin import ApproveDisplayVideo360AdvertiserLinkProposalResponse from .types.analytics_admin import ArchiveCustomDimensionRequest from .types.analytics_admin import ArchiveCustomMetricRequest from .types.analytics_admin import AuditUserLinksRequest @@ -28,9 +30,12 @@ from .types.analytics_admin import BatchGetUserLinksResponse from .types.analytics_admin import BatchUpdateUserLinksRequest from .types.analytics_admin import BatchUpdateUserLinksResponse +from .types.analytics_admin import CancelDisplayVideo360AdvertiserLinkProposalRequest from .types.analytics_admin import CreateConversionEventRequest from .types.analytics_admin import CreateCustomDimensionRequest from .types.analytics_admin import CreateCustomMetricRequest +from .types.analytics_admin import CreateDisplayVideo360AdvertiserLinkProposalRequest +from .types.analytics_admin import CreateDisplayVideo360AdvertiserLinkRequest from .types.analytics_admin import CreateFirebaseLinkRequest from .types.analytics_admin import CreateGoogleAdsLinkRequest from .types.analytics_admin import CreateMeasurementProtocolSecretRequest @@ -40,6 +45,8 @@ from .types.analytics_admin import DeleteAccountRequest from .types.analytics_admin import DeleteAndroidAppDataStreamRequest from .types.analytics_admin import DeleteConversionEventRequest +from .types.analytics_admin import DeleteDisplayVideo360AdvertiserLinkProposalRequest +from .types.analytics_admin import DeleteDisplayVideo360AdvertiserLinkRequest from .types.analytics_admin import DeleteFirebaseLinkRequest from .types.analytics_admin import DeleteGoogleAdsLinkRequest from .types.analytics_admin import DeleteIosAppDataStreamRequest @@ -52,7 +59,10 @@ from .types.analytics_admin import GetConversionEventRequest from .types.analytics_admin import GetCustomDimensionRequest from .types.analytics_admin import GetCustomMetricRequest +from .types.analytics_admin import GetDataRetentionSettingsRequest from .types.analytics_admin import GetDataSharingSettingsRequest +from .types.analytics_admin import GetDisplayVideo360AdvertiserLinkProposalRequest +from .types.analytics_admin import GetDisplayVideo360AdvertiserLinkRequest from .types.analytics_admin import GetEnhancedMeasurementSettingsRequest from .types.analytics_admin import GetGlobalSiteTagRequest from .types.analytics_admin import GetGoogleSignalsSettingsRequest @@ -73,6 +83,10 @@ from .types.analytics_admin import ListCustomDimensionsResponse from .types.analytics_admin import ListCustomMetricsRequest from .types.analytics_admin import ListCustomMetricsResponse +from .types.analytics_admin import ListDisplayVideo360AdvertiserLinkProposalsRequest +from .types.analytics_admin import ListDisplayVideo360AdvertiserLinkProposalsResponse +from .types.analytics_admin import ListDisplayVideo360AdvertiserLinksRequest +from .types.analytics_admin import ListDisplayVideo360AdvertiserLinksResponse from .types.analytics_admin import ListFirebaseLinksRequest from .types.analytics_admin import ListFirebaseLinksResponse from .types.analytics_admin import ListGoogleAdsLinksRequest @@ -95,8 +109,9 @@ from .types.analytics_admin import UpdateAndroidAppDataStreamRequest from .types.analytics_admin import UpdateCustomDimensionRequest from .types.analytics_admin import UpdateCustomMetricRequest +from .types.analytics_admin import UpdateDataRetentionSettingsRequest +from .types.analytics_admin import UpdateDisplayVideo360AdvertiserLinkRequest from .types.analytics_admin import UpdateEnhancedMeasurementSettingsRequest -from .types.analytics_admin import UpdateFirebaseLinkRequest from .types.analytics_admin import UpdateGoogleAdsLinkRequest from .types.analytics_admin import UpdateGoogleSignalsSettingsRequest from .types.analytics_admin import UpdateIosAppDataStreamRequest @@ -113,13 +128,17 @@ from .types.resources import ConversionEvent from .types.resources import CustomDimension from .types.resources import CustomMetric +from .types.resources import DataRetentionSettings from .types.resources import DataSharingSettings +from .types.resources import DisplayVideo360AdvertiserLink +from .types.resources import DisplayVideo360AdvertiserLinkProposal from .types.resources import EnhancedMeasurementSettings from .types.resources import FirebaseLink from .types.resources import GlobalSiteTag from .types.resources import GoogleAdsLink from .types.resources import GoogleSignalsSettings from .types.resources import IosAppDataStream +from .types.resources import LinkProposalStatusDetails from .types.resources import MeasurementProtocolSecret from .types.resources import Property from .types.resources import PropertySummary @@ -131,7 +150,9 @@ from .types.resources import GoogleSignalsConsent from .types.resources import GoogleSignalsState from .types.resources import IndustryCategory -from .types.resources import MaximumUserAccess +from .types.resources import LinkProposalInitiatingProduct +from .types.resources import LinkProposalState +from .types.resources import ServiceLevel __all__ = ( "AnalyticsAdminServiceAsyncClient", @@ -141,6 +162,8 @@ "ActorType", "AnalyticsAdminServiceClient", "AndroidAppDataStream", + "ApproveDisplayVideo360AdvertiserLinkProposalRequest", + "ApproveDisplayVideo360AdvertiserLinkProposalResponse", "ArchiveCustomDimensionRequest", "ArchiveCustomMetricRequest", "AuditUserLink", @@ -153,6 +176,7 @@ "BatchGetUserLinksResponse", "BatchUpdateUserLinksRequest", "BatchUpdateUserLinksResponse", + "CancelDisplayVideo360AdvertiserLinkProposalRequest", "ChangeHistoryChange", "ChangeHistoryEvent", "ChangeHistoryResourceType", @@ -160,6 +184,8 @@ "CreateConversionEventRequest", "CreateCustomDimensionRequest", "CreateCustomMetricRequest", + "CreateDisplayVideo360AdvertiserLinkProposalRequest", + "CreateDisplayVideo360AdvertiserLinkRequest", "CreateFirebaseLinkRequest", "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", @@ -168,10 +194,13 @@ "CreateWebDataStreamRequest", "CustomDimension", "CustomMetric", + "DataRetentionSettings", "DataSharingSettings", "DeleteAccountRequest", "DeleteAndroidAppDataStreamRequest", "DeleteConversionEventRequest", + "DeleteDisplayVideo360AdvertiserLinkProposalRequest", + "DeleteDisplayVideo360AdvertiserLinkRequest", "DeleteFirebaseLinkRequest", "DeleteGoogleAdsLinkRequest", "DeleteIosAppDataStreamRequest", @@ -179,6 +208,8 @@ "DeletePropertyRequest", "DeleteUserLinkRequest", "DeleteWebDataStreamRequest", + "DisplayVideo360AdvertiserLink", + "DisplayVideo360AdvertiserLinkProposal", "EnhancedMeasurementSettings", "FirebaseLink", "GetAccountRequest", @@ -186,7 +217,10 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", + "GetDisplayVideo360AdvertiserLinkProposalRequest", + "GetDisplayVideo360AdvertiserLinkRequest", "GetEnhancedMeasurementSettingsRequest", "GetGlobalSiteTagRequest", "GetGoogleSignalsSettingsRequest", @@ -202,6 +236,9 @@ "GoogleSignalsState", "IndustryCategory", "IosAppDataStream", + "LinkProposalInitiatingProduct", + "LinkProposalState", + "LinkProposalStatusDetails", "ListAccountSummariesRequest", "ListAccountSummariesResponse", "ListAccountsRequest", @@ -214,6 +251,10 @@ "ListCustomDimensionsResponse", "ListCustomMetricsRequest", "ListCustomMetricsResponse", + "ListDisplayVideo360AdvertiserLinkProposalsRequest", + "ListDisplayVideo360AdvertiserLinkProposalsResponse", + "ListDisplayVideo360AdvertiserLinksRequest", + "ListDisplayVideo360AdvertiserLinksResponse", "ListFirebaseLinksRequest", "ListFirebaseLinksResponse", "ListGoogleAdsLinksRequest", @@ -228,7 +269,6 @@ "ListUserLinksResponse", "ListWebDataStreamsRequest", "ListWebDataStreamsResponse", - "MaximumUserAccess", "MeasurementProtocolSecret", "Property", "PropertySummary", @@ -236,12 +276,14 @@ "ProvisionAccountTicketResponse", "SearchChangeHistoryEventsRequest", "SearchChangeHistoryEventsResponse", + "ServiceLevel", "UpdateAccountRequest", "UpdateAndroidAppDataStreamRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRetentionSettingsRequest", + "UpdateDisplayVideo360AdvertiserLinkRequest", "UpdateEnhancedMeasurementSettingsRequest", - "UpdateFirebaseLinkRequest", "UpdateGoogleAdsLinkRequest", "UpdateGoogleSignalsSettingsRequest", "UpdateIosAppDataStreamRequest", diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/gapic_metadata.json b/packages/google-analytics-admin/google/analytics/admin_v1alpha/gapic_metadata.json index fb4e612c35c3..9c1c1b80c31d 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/gapic_metadata.json +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/gapic_metadata.json @@ -10,6 +10,11 @@ "grpc": { "libraryClient": "AnalyticsAdminServiceClient", "rpcs": { + "ApproveDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "approve_display_video360_advertiser_link_proposal" + ] + }, "ArchiveCustomDimension": { "methods": [ "archive_custom_dimension" @@ -45,6 +50,11 @@ "batch_update_user_links" ] }, + "CancelDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "cancel_display_video360_advertiser_link_proposal" + ] + }, "CreateConversionEvent": { "methods": [ "create_conversion_event" @@ -60,6 +70,16 @@ "create_custom_metric" ] }, + "CreateDisplayVideo360AdvertiserLink": { + "methods": [ + "create_display_video360_advertiser_link" + ] + }, + "CreateDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "create_display_video360_advertiser_link_proposal" + ] + }, "CreateFirebaseLink": { "methods": [ "create_firebase_link" @@ -105,6 +125,16 @@ "delete_conversion_event" ] }, + "DeleteDisplayVideo360AdvertiserLink": { + "methods": [ + "delete_display_video360_advertiser_link" + ] + }, + "DeleteDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "delete_display_video360_advertiser_link_proposal" + ] + }, "DeleteFirebaseLink": { "methods": [ "delete_firebase_link" @@ -165,11 +195,26 @@ "get_custom_metric" ] }, + "GetDataRetentionSettings": { + "methods": [ + "get_data_retention_settings" + ] + }, "GetDataSharingSettings": { "methods": [ "get_data_sharing_settings" ] }, + "GetDisplayVideo360AdvertiserLink": { + "methods": [ + "get_display_video360_advertiser_link" + ] + }, + "GetDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "get_display_video360_advertiser_link_proposal" + ] + }, "GetEnhancedMeasurementSettings": { "methods": [ "get_enhanced_measurement_settings" @@ -240,6 +285,16 @@ "list_custom_metrics" ] }, + "ListDisplayVideo360AdvertiserLinkProposals": { + "methods": [ + "list_display_video360_advertiser_link_proposals" + ] + }, + "ListDisplayVideo360AdvertiserLinks": { + "methods": [ + "list_display_video360_advertiser_links" + ] + }, "ListFirebaseLinks": { "methods": [ "list_firebase_links" @@ -305,14 +360,19 @@ "update_custom_metric" ] }, - "UpdateEnhancedMeasurementSettings": { + "UpdateDataRetentionSettings": { "methods": [ - "update_enhanced_measurement_settings" + "update_data_retention_settings" ] }, - "UpdateFirebaseLink": { + "UpdateDisplayVideo360AdvertiserLink": { "methods": [ - "update_firebase_link" + "update_display_video360_advertiser_link" + ] + }, + "UpdateEnhancedMeasurementSettings": { + "methods": [ + "update_enhanced_measurement_settings" ] }, "UpdateGoogleAdsLink": { @@ -355,6 +415,11 @@ "grpc-async": { "libraryClient": "AnalyticsAdminServiceAsyncClient", "rpcs": { + "ApproveDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "approve_display_video360_advertiser_link_proposal" + ] + }, "ArchiveCustomDimension": { "methods": [ "archive_custom_dimension" @@ -390,6 +455,11 @@ "batch_update_user_links" ] }, + "CancelDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "cancel_display_video360_advertiser_link_proposal" + ] + }, "CreateConversionEvent": { "methods": [ "create_conversion_event" @@ -405,6 +475,16 @@ "create_custom_metric" ] }, + "CreateDisplayVideo360AdvertiserLink": { + "methods": [ + "create_display_video360_advertiser_link" + ] + }, + "CreateDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "create_display_video360_advertiser_link_proposal" + ] + }, "CreateFirebaseLink": { "methods": [ "create_firebase_link" @@ -450,6 +530,16 @@ "delete_conversion_event" ] }, + "DeleteDisplayVideo360AdvertiserLink": { + "methods": [ + "delete_display_video360_advertiser_link" + ] + }, + "DeleteDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "delete_display_video360_advertiser_link_proposal" + ] + }, "DeleteFirebaseLink": { "methods": [ "delete_firebase_link" @@ -510,11 +600,26 @@ "get_custom_metric" ] }, + "GetDataRetentionSettings": { + "methods": [ + "get_data_retention_settings" + ] + }, "GetDataSharingSettings": { "methods": [ "get_data_sharing_settings" ] }, + "GetDisplayVideo360AdvertiserLink": { + "methods": [ + "get_display_video360_advertiser_link" + ] + }, + "GetDisplayVideo360AdvertiserLinkProposal": { + "methods": [ + "get_display_video360_advertiser_link_proposal" + ] + }, "GetEnhancedMeasurementSettings": { "methods": [ "get_enhanced_measurement_settings" @@ -585,6 +690,16 @@ "list_custom_metrics" ] }, + "ListDisplayVideo360AdvertiserLinkProposals": { + "methods": [ + "list_display_video360_advertiser_link_proposals" + ] + }, + "ListDisplayVideo360AdvertiserLinks": { + "methods": [ + "list_display_video360_advertiser_links" + ] + }, "ListFirebaseLinks": { "methods": [ "list_firebase_links" @@ -650,14 +765,19 @@ "update_custom_metric" ] }, - "UpdateEnhancedMeasurementSettings": { + "UpdateDataRetentionSettings": { "methods": [ - "update_enhanced_measurement_settings" + "update_data_retention_settings" ] }, - "UpdateFirebaseLink": { + "UpdateDisplayVideo360AdvertiserLink": { "methods": [ - "update_firebase_link" + "update_display_video360_advertiser_link" + ] + }, + "UpdateEnhancedMeasurementSettings": { + "methods": [ + "update_enhanced_measurement_settings" ] }, "UpdateGoogleAdsLink": { diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py index 244f09c1cf88..4d98cba94992 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py @@ -75,12 +75,30 @@ class AnalyticsAdminServiceAsyncClient: parse_custom_metric_path = staticmethod( AnalyticsAdminServiceClient.parse_custom_metric_path ) + data_retention_settings_path = staticmethod( + AnalyticsAdminServiceClient.data_retention_settings_path + ) + parse_data_retention_settings_path = staticmethod( + AnalyticsAdminServiceClient.parse_data_retention_settings_path + ) data_sharing_settings_path = staticmethod( AnalyticsAdminServiceClient.data_sharing_settings_path ) parse_data_sharing_settings_path = staticmethod( AnalyticsAdminServiceClient.parse_data_sharing_settings_path ) + display_video360_advertiser_link_path = staticmethod( + AnalyticsAdminServiceClient.display_video360_advertiser_link_path + ) + parse_display_video360_advertiser_link_path = staticmethod( + AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_path + ) + display_video360_advertiser_link_proposal_path = staticmethod( + AnalyticsAdminServiceClient.display_video360_advertiser_link_proposal_path + ) + parse_display_video360_advertiser_link_proposal_path = staticmethod( + AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_proposal_path + ) enhanced_measurement_settings_path = staticmethod( AnalyticsAdminServiceClient.enhanced_measurement_settings_path ) @@ -2920,92 +2938,6 @@ async def create_firebase_link( # Done; return the response. return response - async def update_firebase_link( - self, - request: analytics_admin.UpdateFirebaseLinkRequest = None, - *, - firebase_link: resources.FirebaseLink = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.FirebaseLink: - r"""Updates a FirebaseLink on a property - - Args: - request (:class:`google.analytics.admin_v1alpha.types.UpdateFirebaseLinkRequest`): - The request object. Request message for - UpdateFirebaseLink RPC - firebase_link (:class:`google.analytics.admin_v1alpha.types.FirebaseLink`): - Required. The Firebase link to - update. - - This corresponds to the ``firebase_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.analytics.admin_v1alpha.types.FirebaseLink: - A link between an GA4 property and a - Firebase project. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([firebase_link, update_mask]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - request = analytics_admin.UpdateFirebaseLinkRequest(request) - - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if firebase_link is not None: - request.firebase_link = firebase_link - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_firebase_link, - default_timeout=60.0, - client_info=DEFAULT_CLIENT_INFO, - ) - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("firebase_link.name", request.firebase_link.name),) - ), - ) - - # Send the request. - response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - async def delete_firebase_link( self, request: analytics_admin.DeleteFirebaseLinkRequest = None, @@ -4544,34 +4476,28 @@ async def list_conversion_events( # Done; return the response. return response - async def create_custom_dimension( + async def get_display_video360_advertiser_link( self, - request: analytics_admin.CreateCustomDimensionRequest = None, + request: analytics_admin.GetDisplayVideo360AdvertiserLinkRequest = None, *, - parent: str = None, - custom_dimension: resources.CustomDimension = None, + name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Creates a CustomDimension. + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Look up a single DisplayVideo360AdvertiserLink Args: - request (:class:`google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest`): + request (:class:`google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest`): The request object. Request message for - CreateCustomDimension RPC. - parent (:class:`str`): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): - Required. The CustomDimension to - create. + GetDisplayVideo360AdvertiserLink RPC. + name (:class:`str`): + Required. The name of the + DisplayVideo360AdvertiserLink to get. + Example format: + properties/1234/displayVideo360AdvertiserLink/5678 - This corresponds to the ``custom_dimension`` field + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -4581,32 +4507,32 @@ async def create_custom_dimension( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_dimension]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.CreateCustomDimensionRequest(request) + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.create_custom_dimension, + self._client._transport.get_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4614,7 +4540,7 @@ async def create_custom_dimension( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -4623,34 +4549,27 @@ async def create_custom_dimension( # Done; return the response. return response - async def update_custom_dimension( + async def list_display_video360_advertiser_links( self, - request: analytics_admin.UpdateCustomDimensionRequest = None, + request: analytics_admin.ListDisplayVideo360AdvertiserLinksRequest = None, *, - custom_dimension: resources.CustomDimension = None, - update_mask: field_mask_pb2.FieldMask = None, + parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Updates a CustomDimension on a property. + ) -> pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: + r"""Lists all DisplayVideo360AdvertiserLinks on a + property. Args: - request (:class:`google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest`): + request (:class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest`): The request object. Request message for - UpdateCustomDimension RPC. - custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): - The CustomDimension to update - This corresponds to the ``custom_dimension`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + ListDisplayVideo360AdvertiserLinks RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -4660,32 +4579,35 @@ async def update_custom_dimension( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksAsyncPager: + Response message for + ListDisplayVideo360AdvertiserLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_dimension, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.UpdateCustomDimensionRequest(request) + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_dimension is not None: - request.custom_dimension = custom_dimension - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.update_custom_dimension, + self._client._transport.list_display_video360_advertiser_links, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4693,32 +4615,42 @@ async def update_custom_dimension( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("custom_dimension.name", request.custom_dimension.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinksAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + # Done; return the response. return response - async def list_custom_dimensions( + async def create_display_video360_advertiser_link( self, - request: analytics_admin.ListCustomDimensionsRequest = None, + request: analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest = None, *, parent: str = None, + display_video_360_advertiser_link: resources.DisplayVideo360AdvertiserLink = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomDimensionsAsyncPager: - r"""Lists CustomDimensions on a property. + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. Args: - request (:class:`google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest`): + request (:class:`google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest`): The request object. Request message for - ListCustomDimensions RPC. + CreateDisplayVideo360AdvertiserLink RPC. parent (:class:`str`): Required. Example format: properties/1234 @@ -4726,6 +4658,13 @@ async def list_custom_dimensions( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): + Required. The + DisplayVideo360AdvertiserLink to create. + + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -4733,35 +4672,36 @@ async def list_custom_dimensions( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager: - Response message for - ListCustomDimensions RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, display_video_360_advertiser_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.ListCustomDimensionsRequest(request) + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.list_custom_dimensions, + self._client._transport.create_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4775,35 +4715,30 @@ async def list_custom_dimensions( # Send the request. response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - # This method is paged; wrap the response in a pager, which provides - # an `__aiter__` convenience method. - response = pagers.ListCustomDimensionsAsyncPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - # Done; return the response. return response - async def archive_custom_dimension( + async def delete_display_video360_advertiser_link( self, - request: analytics_admin.ArchiveCustomDimensionRequest = None, + request: analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Archives a CustomDimension on a property. + r"""Deletes a DisplayVideo360AdvertiserLink on a + property. Args: - request (:class:`google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest`): + request (:class:`google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest`): The request object. Request message for - ArchiveCustomDimension RPC. + DeleteDisplayVideo360AdvertiserLink RPC. name (:class:`str`): Required. The name of the - CustomDimension to archive. Example - format: - properties/1234/customDimensions/5678 + DisplayVideo360AdvertiserLink to delete. + Example format: + properties/1234/displayVideo360AdvertiserLinks/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -4824,7 +4759,7 @@ async def archive_custom_dimension( "the individual field arguments should be set." ) - request = analytics_admin.ArchiveCustomDimensionRequest(request) + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. @@ -4834,7 +4769,7 @@ async def archive_custom_dimension( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.archive_custom_dimension, + self._client._transport.delete_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4850,27 +4785,37 @@ async def archive_custom_dimension( request, retry=retry, timeout=timeout, metadata=metadata, ) - async def get_custom_dimension( + async def update_display_video360_advertiser_link( self, - request: analytics_admin.GetCustomDimensionRequest = None, + request: analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest = None, *, - name: str = None, + display_video_360_advertiser_link: resources.DisplayVideo360AdvertiserLink = None, + update_mask: field_mask_pb2.FieldMask = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Lookup for a single CustomDimension. + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Updates a DisplayVideo360AdvertiserLink on a + property. Args: - request (:class:`google.analytics.admin_v1alpha.types.GetCustomDimensionRequest`): + request (:class:`google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest`): The request object. Request message for - GetCustomDimension RPC. - name (:class:`str`): - Required. The name of the - CustomDimension to get. Example format: - properties/1234/customDimensions/5678 + UpdateDisplayVideo360AdvertiserLink RPC. + display_video_360_advertiser_link (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink`): + The DisplayVideo360AdvertiserLink to + update - This corresponds to the ``name`` field + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -4880,30 +4825,36 @@ async def get_custom_dimension( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([name]) + has_flattened_params = any([display_video_360_advertiser_link, update_mask]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " "the individual field arguments should be set." ) - request = analytics_admin.GetCustomDimensionRequest(request) + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if name is not None: - request.name = name + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) + if update_mask is not None: + request.update_mask = update_mask # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. rpc = gapic_v1.method_async.wrap_method( - self._client._transport.get_custom_dimension, + self._client._transport.update_display_video360_advertiser_link, default_timeout=None, client_info=DEFAULT_CLIENT_INFO, ) @@ -4911,7 +4862,14 @@ async def get_custom_dimension( # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "display_video_360_advertiser_link.name", + request.display_video_360_advertiser_link.name, + ), + ) + ), ) # Send the request. @@ -4920,20 +4878,842 @@ async def get_custom_dimension( # Done; return the response. return response - async def create_custom_metric( + async def get_display_video360_advertiser_link_proposal( self, - request: analytics_admin.CreateCustomMetricRequest = None, + request: analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest = None, *, - parent: str = None, - custom_metric: resources.CustomMetric = None, + name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomMetric: - r"""Creates a CustomMetric. + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Lookup for a single + DisplayVideo360AdvertiserLinkProposal. Args: - request (:class:`google.analytics.admin_v1alpha.types.CreateCustomMetricRequest`): + request (:class:`google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest`): + The request object. Request message for + GetDisplayVideo360AdvertiserLinkProposal RPC. + name (:class:`str`): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + get. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_display_video360_advertiser_link_proposals( + self, + request: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + r"""Lists DisplayVideo360AdvertiserLinkProposals on a + property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest`): + The request object. Request message for + ListDisplayVideo360AdvertiserLinkProposals RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + Response message for + ListDisplayVideo360AdvertiserLinkProposals + RPC. Iterating over this object will + yield results and resolve additional + pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_display_video360_advertiser_link_proposals, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def create_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + parent: str = None, + display_video_360_advertiser_link_proposal: resources.DisplayVideo360AdvertiserLinkProposal = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Creates a DisplayVideo360AdvertiserLinkProposal. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest`): + The request object. Request message for + CreateDisplayVideo360AdvertiserLinkProposal RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + display_video_360_advertiser_link_proposal (:class:`google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal`): + Required. The + DisplayVideo360AdvertiserLinkProposal to + create. + + This corresponds to the ``display_video_360_advertiser_link_proposal`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if display_video_360_advertiser_link_proposal is not None: + request.display_video_360_advertiser_link_proposal = ( + display_video_360_advertiser_link_proposal + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def delete_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest`): + The request object. Request message for + DeleteDisplayVideo360AdvertiserLinkProposal RPC. + name (:class:`str`): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + delete. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.delete_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def approve_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + r"""Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest`): + The request object. Request message for + ApproveDisplayVideo360AdvertiserLinkProposal RPC. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + Response message for + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. + + """ + # Create or coerce a protobuf request object. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.approve_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def cancel_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + - Declining a proposal initiated from Display & Video + 360 - Withdrawing a proposal initiated from Google + Analytics After being cancelled, a proposal will + eventually be deleted automatically. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest`): + The request object. Request message for + CancelDisplayVideo360AdvertiserLinkProposal RPC. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.cancel_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_custom_dimension( + self, + request: analytics_admin.CreateCustomDimensionRequest = None, + *, + parent: str = None, + custom_dimension: resources.CustomDimension = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Creates a CustomDimension. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest`): + The request object. Request message for + CreateCustomDimension RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): + Required. The CustomDimension to + create. + + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, custom_dimension]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.CreateCustomDimensionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if custom_dimension is not None: + request.custom_dimension = custom_dimension + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.create_custom_dimension, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_custom_dimension( + self, + request: analytics_admin.UpdateCustomDimensionRequest = None, + *, + custom_dimension: resources.CustomDimension = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Updates a CustomDimension on a property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest`): + The request object. Request message for + UpdateCustomDimension RPC. + custom_dimension (:class:`google.analytics.admin_v1alpha.types.CustomDimension`): + The CustomDimension to update + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([custom_dimension, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.UpdateCustomDimensionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if custom_dimension is not None: + request.custom_dimension = custom_dimension + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_custom_dimension, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("custom_dimension.name", request.custom_dimension.name),) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def list_custom_dimensions( + self, + request: analytics_admin.ListCustomDimensionsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomDimensionsAsyncPager: + r"""Lists CustomDimensions on a property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest`): + The request object. Request message for + ListCustomDimensions RPC. + parent (:class:`str`): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsAsyncPager: + Response message for + ListCustomDimensions RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ListCustomDimensionsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.list_custom_dimensions, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__aiter__` convenience method. + response = pagers.ListCustomDimensionsAsyncPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + async def archive_custom_dimension( + self, + request: analytics_admin.ArchiveCustomDimensionRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Archives a CustomDimension on a property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest`): + The request object. Request message for + ArchiveCustomDimension RPC. + name (:class:`str`): + Required. The name of the + CustomDimension to archive. Example + format: + properties/1234/customDimensions/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.ArchiveCustomDimensionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.archive_custom_dimension, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + await rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + async def get_custom_dimension( + self, + request: analytics_admin.GetCustomDimensionRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Lookup for a single CustomDimension. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.GetCustomDimensionRequest`): + The request object. Request message for + GetCustomDimension RPC. + name (:class:`str`): + Required. The name of the + CustomDimension to get. Example format: + properties/1234/customDimensions/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetCustomDimensionRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_custom_dimension, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def create_custom_metric( + self, + request: analytics_admin.CreateCustomMetricRequest = None, + *, + parent: str = None, + custom_metric: resources.CustomMetric = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomMetric: + r"""Creates a CustomMetric. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.CreateCustomMetricRequest`): The request object. Request message for CreateCustomMetric RPC. parent (:class:`str`): @@ -5293,6 +6073,173 @@ async def get_custom_metric( # Done; return the response. return response + async def get_data_retention_settings( + self, + request: analytics_admin.GetDataRetentionSettingsRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataRetentionSettings: + r"""Returns the singleton data retention settings for + this property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest`): + The request object. Request message for + GetDataRetentionSettings RPC. + name (:class:`str`): + Required. The name of the settings to + lookup. Format: + properties/{property}/dataRetentionSettings + Example: + "properties/1000/dataRetentionSettings" + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.GetDataRetentionSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.get_data_retention_settings, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + async def update_data_retention_settings( + self, + request: analytics_admin.UpdateDataRetentionSettingsRequest = None, + *, + data_retention_settings: resources.DataRetentionSettings = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataRetentionSettings: + r"""Updates the singleton data retention settings for + this property. + + Args: + request (:class:`google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest`): + The request object. Request message for + UpdateDataRetentionSettings RPC. + data_retention_settings (:class:`google.analytics.admin_v1alpha.types.DataRetentionSettings`): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. + + This corresponds to the ``data_retention_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (:class:`google.protobuf.field_mask_pb2.FieldMask`): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([data_retention_settings, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if data_retention_settings is not None: + request.data_retention_settings = data_retention_settings + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = gapic_v1.method_async.wrap_method( + self._client._transport.update_data_retention_settings, + default_timeout=None, + client_info=DEFAULT_CLIENT_INFO, + ) + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_retention_settings.name", + request.data_retention_settings.name, + ), + ) + ), + ) + + # Send the request. + response = await rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py index 38b1d7c102c9..16e2ba1468f0 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py @@ -241,6 +241,17 @@ def parse_custom_metric_path(path: str) -> Dict[str, str]: m = re.match(r"^properties/(?P.+?)/customMetrics$", path) return m.groupdict() if m else {} + @staticmethod + def data_retention_settings_path(property: str,) -> str: + """Returns a fully-qualified data_retention_settings string.""" + return "properties/{property}/dataRetentionSettings".format(property=property,) + + @staticmethod + def parse_data_retention_settings_path(path: str) -> Dict[str, str]: + """Parses a data_retention_settings path into its component segments.""" + m = re.match(r"^properties/(?P.+?)/dataRetentionSettings$", path) + return m.groupdict() if m else {} + @staticmethod def data_sharing_settings_path(account: str,) -> str: """Returns a fully-qualified data_sharing_settings string.""" @@ -252,6 +263,46 @@ def parse_data_sharing_settings_path(path: str) -> Dict[str, str]: m = re.match(r"^accounts/(?P.+?)/dataSharingSettings$", path) return m.groupdict() if m else {} + @staticmethod + def display_video360_advertiser_link_path( + property: str, display_video_360_advertiser_link: str, + ) -> str: + """Returns a fully-qualified display_video360_advertiser_link string.""" + return "properties/{property}/displayVideo360AdvertiserLinks/{display_video_360_advertiser_link}".format( + property=property, + display_video_360_advertiser_link=display_video_360_advertiser_link, + ) + + @staticmethod + def parse_display_video360_advertiser_link_path(path: str) -> Dict[str, str]: + """Parses a display_video360_advertiser_link path into its component segments.""" + m = re.match( + r"^properties/(?P.+?)/displayVideo360AdvertiserLinks/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + + @staticmethod + def display_video360_advertiser_link_proposal_path( + property: str, display_video_360_advertiser_link_proposal: str, + ) -> str: + """Returns a fully-qualified display_video360_advertiser_link_proposal string.""" + return "properties/{property}/displayVideo360AdvertiserLinkProposals/{display_video_360_advertiser_link_proposal}".format( + property=property, + display_video_360_advertiser_link_proposal=display_video_360_advertiser_link_proposal, + ) + + @staticmethod + def parse_display_video360_advertiser_link_proposal_path( + path: str, + ) -> Dict[str, str]: + """Parses a display_video360_advertiser_link_proposal path into its component segments.""" + m = re.match( + r"^properties/(?P.+?)/displayVideo360AdvertiserLinkProposals/(?P.+?)$", + path, + ) + return m.groupdict() if m else {} + @staticmethod def enhanced_measurement_settings_path(property: str, web_data_stream: str,) -> str: """Returns a fully-qualified enhanced_measurement_settings string.""" @@ -3273,92 +3324,6 @@ def create_firebase_link( # Done; return the response. return response - def update_firebase_link( - self, - request: analytics_admin.UpdateFirebaseLinkRequest = None, - *, - firebase_link: resources.FirebaseLink = None, - update_mask: field_mask_pb2.FieldMask = None, - retry: retries.Retry = gapic_v1.method.DEFAULT, - timeout: float = None, - metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.FirebaseLink: - r"""Updates a FirebaseLink on a property - - Args: - request (google.analytics.admin_v1alpha.types.UpdateFirebaseLinkRequest): - The request object. Request message for - UpdateFirebaseLink RPC - firebase_link (google.analytics.admin_v1alpha.types.FirebaseLink): - Required. The Firebase link to - update. - - This corresponds to the ``firebase_link`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names - must be in snake case (e.g., "field_to_update"). Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. - - This corresponds to the ``update_mask`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - retry (google.api_core.retry.Retry): Designation of what errors, if any, - should be retried. - timeout (float): The timeout for this request. - metadata (Sequence[Tuple[str, str]]): Strings which should be - sent along with the request as metadata. - - Returns: - google.analytics.admin_v1alpha.types.FirebaseLink: - A link between an GA4 property and a - Firebase project. - - """ - # Create or coerce a protobuf request object. - # Sanity check: If we got a request object, we should *not* have - # gotten any keyword arguments that map to the request. - has_flattened_params = any([firebase_link, update_mask]) - if request is not None and has_flattened_params: - raise ValueError( - "If the `request` argument is set, then none of " - "the individual field arguments should be set." - ) - - # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateFirebaseLinkRequest. - # There's no risk of modifying the input as we've already verified - # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateFirebaseLinkRequest): - request = analytics_admin.UpdateFirebaseLinkRequest(request) - # If we have keyword arguments corresponding to fields on the - # request, apply these. - if firebase_link is not None: - request.firebase_link = firebase_link - if update_mask is not None: - request.update_mask = update_mask - - # Wrap the RPC method; this adds retry and timeout information, - # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_firebase_link] - - # Certain fields should be provided within the metadata header; - # add these here. - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("firebase_link.name", request.firebase_link.name),) - ), - ) - - # Send the request. - response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - - # Done; return the response. - return response - def delete_firebase_link( self, request: analytics_admin.DeleteFirebaseLinkRequest = None, @@ -4924,34 +4889,28 @@ def list_conversion_events( # Done; return the response. return response - def create_custom_dimension( + def get_display_video360_advertiser_link( self, - request: analytics_admin.CreateCustomDimensionRequest = None, + request: analytics_admin.GetDisplayVideo360AdvertiserLinkRequest = None, *, - parent: str = None, - custom_dimension: resources.CustomDimension = None, + name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Creates a CustomDimension. + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Look up a single DisplayVideo360AdvertiserLink Args: - request (google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest): + request (google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkRequest): The request object. Request message for - CreateCustomDimension RPC. - parent (str): - Required. Example format: - properties/1234 - - This corresponds to the ``parent`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): - Required. The CustomDimension to - create. + GetDisplayVideo360AdvertiserLink RPC. + name (str): + Required. The name of the + DisplayVideo360AdvertiserLink to get. + Example format: + properties/1234/displayVideo360AdvertiserLink/5678 - This corresponds to the ``custom_dimension`` field + This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -4961,13 +4920,15 @@ def create_custom_dimension( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent, custom_dimension]) + has_flattened_params = any([name]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -4975,26 +4936,28 @@ def create_custom_dimension( ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.CreateCustomDimensionRequest. + # in a analytics_admin.GetDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.CreateCustomDimensionRequest): - request = analytics_admin.CreateCustomDimensionRequest(request) + if not isinstance( + request, analytics_admin.GetDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if parent is not None: - request.parent = parent - if custom_dimension is not None: - request.custom_dimension = custom_dimension + if name is not None: + request.name = name # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.create_custom_dimension] + rpc = self._transport._wrapped_methods[ + self._transport.get_display_video360_advertiser_link + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), ) # Send the request. @@ -5003,34 +4966,27 @@ def create_custom_dimension( # Done; return the response. return response - def update_custom_dimension( + def list_display_video360_advertiser_links( self, - request: analytics_admin.UpdateCustomDimensionRequest = None, + request: analytics_admin.ListDisplayVideo360AdvertiserLinksRequest = None, *, - custom_dimension: resources.CustomDimension = None, - update_mask: field_mask_pb2.FieldMask = None, + parent: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> resources.CustomDimension: - r"""Updates a CustomDimension on a property. + ) -> pagers.ListDisplayVideo360AdvertiserLinksPager: + r"""Lists all DisplayVideo360AdvertiserLinks on a + property. Args: - request (google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest): + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest): The request object. Request message for - UpdateCustomDimension RPC. - custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): - The CustomDimension to update - This corresponds to the ``custom_dimension`` field - on the ``request`` instance; if ``request`` is provided, this - should not be set. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Omitted - fields will not be updated. To replace the entire - entity, use one path with the string "*" to match all - fields. + ListDisplayVideo360AdvertiserLinks RPC. + parent (str): + Required. Example format: + properties/1234 - This corresponds to the ``update_mask`` field + This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, @@ -5040,13 +4996,18 @@ def update_custom_dimension( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.types.CustomDimension: - A definition for a CustomDimension. + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinksPager: + Response message for + ListDisplayVideo360AdvertiserLinks RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([custom_dimension, update_mask]) + has_flattened_params = any([parent]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5054,51 +5015,63 @@ def update_custom_dimension( ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.UpdateCustomDimensionRequest. + # in a analytics_admin.ListDisplayVideo360AdvertiserLinksRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.UpdateCustomDimensionRequest): - request = analytics_admin.UpdateCustomDimensionRequest(request) + if not isinstance( + request, analytics_admin.ListDisplayVideo360AdvertiserLinksRequest + ): + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(request) # If we have keyword arguments corresponding to fields on the # request, apply these. - if custom_dimension is not None: - request.custom_dimension = custom_dimension - if update_mask is not None: - request.update_mask = update_mask + if parent is not None: + request.parent = parent # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.update_custom_dimension] + rpc = self._transport._wrapped_methods[ + self._transport.list_display_video360_advertiser_links + ] # Certain fields should be provided within the metadata header; # add these here. metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata( - (("custom_dimension.name", request.custom_dimension.name),) - ), + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), ) # Send the request. response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinksPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + # Done; return the response. return response - def list_custom_dimensions( + def create_display_video360_advertiser_link( self, - request: analytics_admin.ListCustomDimensionsRequest = None, + request: analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest = None, *, parent: str = None, + display_video_360_advertiser_link: resources.DisplayVideo360AdvertiserLink = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), - ) -> pagers.ListCustomDimensionsPager: - r"""Lists CustomDimensions on a property. + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. Args: - request (google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest): + request (google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkRequest): The request object. Request message for - ListCustomDimensions RPC. + CreateDisplayVideo360AdvertiserLink RPC. parent (str): Required. Example format: properties/1234 @@ -5106,6 +5079,13 @@ def list_custom_dimensions( This corresponds to the ``parent`` field on the ``request`` instance; if ``request`` is provided, this should not be set. + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + Required. The + DisplayVideo360AdvertiserLink to create. + + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. retry (google.api_core.retry.Retry): Designation of what errors, if any, should be retried. timeout (float): The timeout for this request. @@ -5113,18 +5093,15 @@ def list_custom_dimensions( sent along with the request as metadata. Returns: - google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsPager: - Response message for - ListCustomDimensions RPC. - Iterating over this object will yield - results and resolve additional pages - automatically. + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. """ # Create or coerce a protobuf request object. # Sanity check: If we got a request object, we should *not* have # gotten any keyword arguments that map to the request. - has_flattened_params = any([parent]) + has_flattened_params = any([parent, display_video_360_advertiser_link]) if request is not None and has_flattened_params: raise ValueError( "If the `request` argument is set, then none of " @@ -5132,19 +5109,29 @@ def list_custom_dimensions( ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ListCustomDimensionsRequest. + # in a analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ListCustomDimensionsRequest): - request = analytics_admin.ListCustomDimensionsRequest(request) + if not isinstance( + request, analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. if parent is not None: request.parent = parent + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.list_custom_dimensions] + rpc = self._transport._wrapped_methods[ + self._transport.create_display_video360_advertiser_link + ] # Certain fields should be provided within the metadata header; # add these here. @@ -5155,35 +5142,30 @@ def list_custom_dimensions( # Send the request. response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) - # This method is paged; wrap the response in a pager, which provides - # an `__iter__` convenience method. - response = pagers.ListCustomDimensionsPager( - method=rpc, request=request, response=response, metadata=metadata, - ) - # Done; return the response. return response - def archive_custom_dimension( + def delete_display_video360_advertiser_link( self, - request: analytics_admin.ArchiveCustomDimensionRequest = None, + request: analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest = None, *, name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), ) -> None: - r"""Archives a CustomDimension on a property. + r"""Deletes a DisplayVideo360AdvertiserLink on a + property. Args: - request (google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest): + request (google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkRequest): The request object. Request message for - ArchiveCustomDimension RPC. + DeleteDisplayVideo360AdvertiserLink RPC. name (str): Required. The name of the - CustomDimension to archive. Example - format: - properties/1234/customDimensions/5678 + DisplayVideo360AdvertiserLink to delete. + Example format: + properties/1234/displayVideo360AdvertiserLinks/5678 This corresponds to the ``name`` field on the ``request`` instance; if ``request`` is provided, this @@ -5205,11 +5187,15 @@ def archive_custom_dimension( ) # Minor optimization to avoid making a copy if the user passes - # in a analytics_admin.ArchiveCustomDimensionRequest. + # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest. # There's no risk of modifying the input as we've already verified # there are no flattened fields. - if not isinstance(request, analytics_admin.ArchiveCustomDimensionRequest): - request = analytics_admin.ArchiveCustomDimensionRequest(request) + if not isinstance( + request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest( + request + ) # If we have keyword arguments corresponding to fields on the # request, apply these. if name is not None: @@ -5217,7 +5203,9 @@ def archive_custom_dimension( # Wrap the RPC method; this adds retry and timeout information, # and friendly error handling. - rpc = self._transport._wrapped_methods[self._transport.archive_custom_dimension] + rpc = self._transport._wrapped_methods[ + self._transport.delete_display_video360_advertiser_link + ] # Certain fields should be provided within the metadata header; # add these here. @@ -5230,11 +5218,888 @@ def archive_custom_dimension( request, retry=retry, timeout=timeout, metadata=metadata, ) - def get_custom_dimension( + def update_display_video360_advertiser_link( self, - request: analytics_admin.GetCustomDimensionRequest = None, + request: analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest = None, *, - name: str = None, + display_video_360_advertiser_link: resources.DisplayVideo360AdvertiserLink = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLink: + r"""Updates a DisplayVideo360AdvertiserLink on a + property. + + Args: + request (google.analytics.admin_v1alpha.types.UpdateDisplayVideo360AdvertiserLinkRequest): + The request object. Request message for + UpdateDisplayVideo360AdvertiserLink RPC. + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + The DisplayVideo360AdvertiserLink to + update + + This corresponds to the ``display_video_360_advertiser_link`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink: + A link between a GA4 property and a + Display & Video 360 advertiser. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([display_video_360_advertiser_link, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest + ): + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if display_video_360_advertiser_link is not None: + request.display_video_360_advertiser_link = ( + display_video_360_advertiser_link + ) + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.update_display_video360_advertiser_link + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "display_video_360_advertiser_link.name", + request.display_video_360_advertiser_link.name, + ), + ) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def get_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Lookup for a single + DisplayVideo360AdvertiserLinkProposal. + + Args: + request (google.analytics.admin_v1alpha.types.GetDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + GetDisplayVideo360AdvertiserLinkProposal RPC. + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + get. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.get_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_display_video360_advertiser_link_proposals( + self, + request: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: + r"""Lists DisplayVideo360AdvertiserLinkProposals on a + property. + + Args: + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest): + The request object. Request message for + ListDisplayVideo360AdvertiserLinkProposals RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListDisplayVideo360AdvertiserLinkProposalsPager: + Response message for + ListDisplayVideo360AdvertiserLinkProposals + RPC. Iterating over this object will + yield results and resolve additional + pages automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest + ): + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.list_display_video360_advertiser_link_proposals + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListDisplayVideo360AdvertiserLinkProposalsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def create_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + parent: str = None, + display_video_360_advertiser_link_proposal: resources.DisplayVideo360AdvertiserLinkProposal = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Creates a DisplayVideo360AdvertiserLinkProposal. + + Args: + request (google.analytics.admin_v1alpha.types.CreateDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + CreateDisplayVideo360AdvertiserLinkProposal RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + display_video_360_advertiser_link_proposal (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal): + Required. The + DisplayVideo360AdvertiserLinkProposal to + create. + + This corresponds to the ``display_video_360_advertiser_link_proposal`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, display_video_360_advertiser_link_proposal]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if display_video_360_advertiser_link_proposal is not None: + request.display_video_360_advertiser_link_proposal = ( + display_video_360_advertiser_link_proposal + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.create_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def delete_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. + + Args: + request (google.analytics.admin_v1alpha.types.DeleteDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + DeleteDisplayVideo360AdvertiserLinkProposal RPC. + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + delete. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.delete_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def approve_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + r"""Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. + + Args: + request (google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + ApproveDisplayVideo360AdvertiserLinkProposal RPC. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.ApproveDisplayVideo360AdvertiserLinkProposalResponse: + Response message for + ApproveDisplayVideo360AdvertiserLinkProposal + RPC. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.approve_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def cancel_display_video360_advertiser_link_proposal( + self, + request: analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest = None, + *, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DisplayVideo360AdvertiserLinkProposal: + r"""Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + - Declining a proposal initiated from Display & Video + 360 - Withdrawing a proposal initiated from Google + Analytics After being cancelled, a proposal will + eventually be deleted automatically. + + Args: + request (google.analytics.admin_v1alpha.types.CancelDisplayVideo360AdvertiserLinkProposalRequest): + The request object. Request message for + CancelDisplayVideo360AdvertiserLinkProposal RPC. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal: + A proposal for a link between an GA4 + property and a Display & Video 360 + advertiser. + A proposal is converted to a + DisplayVideo360AdvertiserLink once + approved. Google Analytics admins + approve inbound proposals while Display + & Video 360 admins approve outbound + proposals. + + """ + # Create or coerce a protobuf request object. + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance( + request, analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest + ): + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest( + request + ) + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.cancel_display_video360_advertiser_link_proposal + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def create_custom_dimension( + self, + request: analytics_admin.CreateCustomDimensionRequest = None, + *, + parent: str = None, + custom_dimension: resources.CustomDimension = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Creates a CustomDimension. + + Args: + request (google.analytics.admin_v1alpha.types.CreateCustomDimensionRequest): + The request object. Request message for + CreateCustomDimension RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): + Required. The CustomDimension to + create. + + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent, custom_dimension]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.CreateCustomDimensionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.CreateCustomDimensionRequest): + request = analytics_admin.CreateCustomDimensionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + if custom_dimension is not None: + request.custom_dimension = custom_dimension + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.create_custom_dimension] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_custom_dimension( + self, + request: analytics_admin.UpdateCustomDimensionRequest = None, + *, + custom_dimension: resources.CustomDimension = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.CustomDimension: + r"""Updates a CustomDimension on a property. + + Args: + request (google.analytics.admin_v1alpha.types.UpdateCustomDimensionRequest): + The request object. Request message for + UpdateCustomDimension RPC. + custom_dimension (google.analytics.admin_v1alpha.types.CustomDimension): + The CustomDimension to update + This corresponds to the ``custom_dimension`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.CustomDimension: + A definition for a CustomDimension. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([custom_dimension, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.UpdateCustomDimensionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.UpdateCustomDimensionRequest): + request = analytics_admin.UpdateCustomDimensionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if custom_dimension is not None: + request.custom_dimension = custom_dimension + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.update_custom_dimension] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("custom_dimension.name", request.custom_dimension.name),) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def list_custom_dimensions( + self, + request: analytics_admin.ListCustomDimensionsRequest = None, + *, + parent: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> pagers.ListCustomDimensionsPager: + r"""Lists CustomDimensions on a property. + + Args: + request (google.analytics.admin_v1alpha.types.ListCustomDimensionsRequest): + The request object. Request message for + ListCustomDimensions RPC. + parent (str): + Required. Example format: + properties/1234 + + This corresponds to the ``parent`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.services.analytics_admin_service.pagers.ListCustomDimensionsPager: + Response message for + ListCustomDimensions RPC. + Iterating over this object will yield + results and resolve additional pages + automatically. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([parent]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.ListCustomDimensionsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.ListCustomDimensionsRequest): + request = analytics_admin.ListCustomDimensionsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if parent is not None: + request.parent = parent + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.list_custom_dimensions] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", request.parent),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # This method is paged; wrap the response in a pager, which provides + # an `__iter__` convenience method. + response = pagers.ListCustomDimensionsPager( + method=rpc, request=request, response=response, metadata=metadata, + ) + + # Done; return the response. + return response + + def archive_custom_dimension( + self, + request: analytics_admin.ArchiveCustomDimensionRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> None: + r"""Archives a CustomDimension on a property. + + Args: + request (google.analytics.admin_v1alpha.types.ArchiveCustomDimensionRequest): + The request object. Request message for + ArchiveCustomDimension RPC. + name (str): + Required. The name of the + CustomDimension to archive. Example + format: + properties/1234/customDimensions/5678 + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.ArchiveCustomDimensionRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.ArchiveCustomDimensionRequest): + request = analytics_admin.ArchiveCustomDimensionRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[self._transport.archive_custom_dimension] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + rpc( + request, retry=retry, timeout=timeout, metadata=metadata, + ) + + def get_custom_dimension( + self, + request: analytics_admin.GetCustomDimensionRequest = None, + *, + name: str = None, retry: retries.Retry = gapic_v1.method.DEFAULT, timeout: float = None, metadata: Sequence[Tuple[str, str]] = (), @@ -5673,6 +6538,177 @@ def get_custom_metric( # Done; return the response. return response + def get_data_retention_settings( + self, + request: analytics_admin.GetDataRetentionSettingsRequest = None, + *, + name: str = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataRetentionSettings: + r"""Returns the singleton data retention settings for + this property. + + Args: + request (google.analytics.admin_v1alpha.types.GetDataRetentionSettingsRequest): + The request object. Request message for + GetDataRetentionSettings RPC. + name (str): + Required. The name of the settings to + lookup. Format: + properties/{property}/dataRetentionSettings + Example: + "properties/1000/dataRetentionSettings" + + This corresponds to the ``name`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([name]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.GetDataRetentionSettingsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.GetDataRetentionSettingsRequest): + request = analytics_admin.GetDataRetentionSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if name is not None: + request.name = name + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.get_data_retention_settings + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("name", request.name),)), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + + def update_data_retention_settings( + self, + request: analytics_admin.UpdateDataRetentionSettingsRequest = None, + *, + data_retention_settings: resources.DataRetentionSettings = None, + update_mask: field_mask_pb2.FieldMask = None, + retry: retries.Retry = gapic_v1.method.DEFAULT, + timeout: float = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.DataRetentionSettings: + r"""Updates the singleton data retention settings for + this property. + + Args: + request (google.analytics.admin_v1alpha.types.UpdateDataRetentionSettingsRequest): + The request object. Request message for + UpdateDataRetentionSettings RPC. + data_retention_settings (google.analytics.admin_v1alpha.types.DataRetentionSettings): + Required. The settings to update. The ``name`` field is + used to identify the settings to be updated. + + This corresponds to the ``data_retention_settings`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names + must be in snake case (e.g., "field_to_update"). Omitted + fields will not be updated. To replace the entire + entity, use one path with the string "*" to match all + fields. + + This corresponds to the ``update_mask`` field + on the ``request`` instance; if ``request`` is provided, this + should not be set. + retry (google.api_core.retry.Retry): Designation of what errors, if any, + should be retried. + timeout (float): The timeout for this request. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + + Returns: + google.analytics.admin_v1alpha.types.DataRetentionSettings: + Settings values for data retention. + This is a singleton resource. + + """ + # Create or coerce a protobuf request object. + # Sanity check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([data_retention_settings, update_mask]) + if request is not None and has_flattened_params: + raise ValueError( + "If the `request` argument is set, then none of " + "the individual field arguments should be set." + ) + + # Minor optimization to avoid making a copy if the user passes + # in a analytics_admin.UpdateDataRetentionSettingsRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.UpdateDataRetentionSettingsRequest): + request = analytics_admin.UpdateDataRetentionSettingsRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if data_retention_settings is not None: + request.data_retention_settings = data_retention_settings + if update_mask is not None: + request.update_mask = update_mask + + # Wrap the RPC method; this adds retry and timeout information, + # and friendly error handling. + rpc = self._transport._wrapped_methods[ + self._transport.update_data_retention_settings + ] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + ( + ( + "data_retention_settings.name", + request.data_retention_settings.name, + ), + ) + ), + ) + + # Send the request. + response = rpc(request, retry=retry, timeout=timeout, metadata=metadata,) + + # Done; return the response. + return response + try: DEFAULT_CLIENT_INFO = gapic_v1.client_info.ClientInfo( diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py index ab45c77f3e6d..238acbeb6cbe 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/pagers.py @@ -1710,6 +1710,293 @@ def __repr__(self) -> str: return "{0}<{1!r}>".format(self.__class__.__name__, self._response) +class ListDisplayVideo360AdvertiserLinksPager: + """A pager for iterating through ``list_display_video360_advertiser_links`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse` object, and + provides an ``__iter__`` method to iterate through its + ``display_video_360_advertiser_links`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListDisplayVideo360AdvertiserLinks`` requests and continue to iterate + through the ``display_video_360_advertiser_links`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., analytics_admin.ListDisplayVideo360AdvertiserLinksResponse + ], + request: analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + response: analytics_admin.ListDisplayVideo360AdvertiserLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest( + request + ) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages( + self, + ) -> Iterable[analytics_admin.ListDisplayVideo360AdvertiserLinksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[resources.DisplayVideo360AdvertiserLink]: + for page in self.pages: + yield from page.display_video_360_advertiser_links + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListDisplayVideo360AdvertiserLinksAsyncPager: + """A pager for iterating through ``list_display_video360_advertiser_links`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``display_video_360_advertiser_links`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListDisplayVideo360AdvertiserLinks`` requests and continue to iterate + through the ``display_video_360_advertiser_links`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., Awaitable[analytics_admin.ListDisplayVideo360AdvertiserLinksResponse] + ], + request: analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, + response: analytics_admin.ListDisplayVideo360AdvertiserLinksResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinksResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest( + request + ) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterable[analytics_admin.ListDisplayVideo360AdvertiserLinksResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__(self) -> AsyncIterable[resources.DisplayVideo360AdvertiserLink]: + async def async_generator(): + async for page in self.pages: + for response in page.display_video_360_advertiser_links: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListDisplayVideo360AdvertiserLinkProposalsPager: + """A pager for iterating through ``list_display_video360_advertiser_link_proposals`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse` object, and + provides an ``__iter__`` method to iterate through its + ``display_video_360_advertiser_link_proposals`` field. + + If there are more pages, the ``__iter__`` method will make additional + ``ListDisplayVideo360AdvertiserLinkProposals`` requests and continue to iterate + through the ``display_video_360_advertiser_link_proposals`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse + ], + request: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, + response: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiate the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + def pages( + self, + ) -> Iterable[analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = self._method(self._request, metadata=self._metadata) + yield self._response + + def __iter__(self) -> Iterable[resources.DisplayVideo360AdvertiserLinkProposal]: + for page in self.pages: + yield from page.display_video_360_advertiser_link_proposals + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + +class ListDisplayVideo360AdvertiserLinkProposalsAsyncPager: + """A pager for iterating through ``list_display_video360_advertiser_link_proposals`` requests. + + This class thinly wraps an initial + :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse` object, and + provides an ``__aiter__`` method to iterate through its + ``display_video_360_advertiser_link_proposals`` field. + + If there are more pages, the ``__aiter__`` method will make additional + ``ListDisplayVideo360AdvertiserLinkProposals`` requests and continue to iterate + through the ``display_video_360_advertiser_link_proposals`` field on the + corresponding responses. + + All the usual :class:`google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse` + attributes are available on the pager. If multiple requests are made, only + the most recent response is retained, and thus used for attribute lookup. + """ + + def __init__( + self, + method: Callable[ + ..., + Awaitable[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse + ], + ], + request: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, + response: analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse, + *, + metadata: Sequence[Tuple[str, str]] = () + ): + """Instantiates the pager. + + Args: + method (Callable): The method that was originally called, and + which instantiated this pager. + request (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsRequest): + The initial request object. + response (google.analytics.admin_v1alpha.types.ListDisplayVideo360AdvertiserLinkProposalsResponse): + The initial response object. + metadata (Sequence[Tuple[str, str]]): Strings which should be + sent along with the request as metadata. + """ + self._method = method + self._request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest( + request + ) + self._response = response + self._metadata = metadata + + def __getattr__(self, name: str) -> Any: + return getattr(self._response, name) + + @property + async def pages( + self, + ) -> AsyncIterable[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse + ]: + yield self._response + while self._response.next_page_token: + self._request.page_token = self._response.next_page_token + self._response = await self._method(self._request, metadata=self._metadata) + yield self._response + + def __aiter__( + self, + ) -> AsyncIterable[resources.DisplayVideo360AdvertiserLinkProposal]: + async def async_generator(): + async for page in self.pages: + for response in page.display_video_360_advertiser_link_proposals: + yield response + + return async_generator() + + def __repr__(self) -> str: + return "{0}<{1!r}>".format(self.__class__.__name__, self._response) + + class ListCustomDimensionsPager: """A pager for iterating through ``list_custom_dimensions`` requests. diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py index a1996ee95c98..6107c7e0dec4 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py @@ -312,11 +312,6 @@ def _prep_wrapped_messages(self, client_info): default_timeout=60.0, client_info=client_info, ), - self.update_firebase_link: gapic_v1.method.wrap_method( - self.update_firebase_link, - default_timeout=60.0, - client_info=client_info, - ), self.delete_firebase_link: gapic_v1.method.wrap_method( self.delete_firebase_link, default_timeout=60.0, @@ -413,6 +408,61 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.get_display_video360_advertiser_link: gapic_v1.method.wrap_method( + self.get_display_video360_advertiser_link, + default_timeout=None, + client_info=client_info, + ), + self.list_display_video360_advertiser_links: gapic_v1.method.wrap_method( + self.list_display_video360_advertiser_links, + default_timeout=None, + client_info=client_info, + ), + self.create_display_video360_advertiser_link: gapic_v1.method.wrap_method( + self.create_display_video360_advertiser_link, + default_timeout=None, + client_info=client_info, + ), + self.delete_display_video360_advertiser_link: gapic_v1.method.wrap_method( + self.delete_display_video360_advertiser_link, + default_timeout=None, + client_info=client_info, + ), + self.update_display_video360_advertiser_link: gapic_v1.method.wrap_method( + self.update_display_video360_advertiser_link, + default_timeout=None, + client_info=client_info, + ), + self.get_display_video360_advertiser_link_proposal: gapic_v1.method.wrap_method( + self.get_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=client_info, + ), + self.list_display_video360_advertiser_link_proposals: gapic_v1.method.wrap_method( + self.list_display_video360_advertiser_link_proposals, + default_timeout=None, + client_info=client_info, + ), + self.create_display_video360_advertiser_link_proposal: gapic_v1.method.wrap_method( + self.create_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=client_info, + ), + self.delete_display_video360_advertiser_link_proposal: gapic_v1.method.wrap_method( + self.delete_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=client_info, + ), + self.approve_display_video360_advertiser_link_proposal: gapic_v1.method.wrap_method( + self.approve_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=client_info, + ), + self.cancel_display_video360_advertiser_link_proposal: gapic_v1.method.wrap_method( + self.cancel_display_video360_advertiser_link_proposal, + default_timeout=None, + client_info=client_info, + ), self.create_custom_dimension: gapic_v1.method.wrap_method( self.create_custom_dimension, default_timeout=None, @@ -459,6 +509,16 @@ def _prep_wrapped_messages(self, client_info): self.get_custom_metric: gapic_v1.method.wrap_method( self.get_custom_metric, default_timeout=None, client_info=client_info, ), + self.get_data_retention_settings: gapic_v1.method.wrap_method( + self.get_data_retention_settings, + default_timeout=None, + client_info=client_info, + ), + self.update_data_retention_settings: gapic_v1.method.wrap_method( + self.update_data_retention_settings, + default_timeout=None, + client_info=client_info, + ), } @property @@ -840,15 +900,6 @@ def create_firebase_link( ]: raise NotImplementedError() - @property - def update_firebase_link( - self, - ) -> Callable[ - [analytics_admin.UpdateFirebaseLinkRequest], - Union[resources.FirebaseLink, Awaitable[resources.FirebaseLink]], - ]: - raise NotImplementedError() - @property def delete_firebase_link( self, @@ -1057,6 +1108,136 @@ def list_conversion_events( ]: raise NotImplementedError() + @property + def get_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkRequest], + Union[ + resources.DisplayVideo360AdvertiserLink, + Awaitable[resources.DisplayVideo360AdvertiserLink], + ], + ]: + raise NotImplementedError() + + @property + def list_display_video360_advertiser_links( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinksRequest], + Union[ + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse, + Awaitable[analytics_admin.ListDisplayVideo360AdvertiserLinksResponse], + ], + ]: + raise NotImplementedError() + + @property + def create_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest], + Union[ + resources.DisplayVideo360AdvertiserLink, + Awaitable[resources.DisplayVideo360AdvertiserLink], + ], + ]: + raise NotImplementedError() + + @property + def delete_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + + @property + def update_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest], + Union[ + resources.DisplayVideo360AdvertiserLink, + Awaitable[resources.DisplayVideo360AdvertiserLink], + ], + ]: + raise NotImplementedError() + + @property + def get_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest], + Union[ + resources.DisplayVideo360AdvertiserLinkProposal, + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ], + ]: + raise NotImplementedError() + + @property + def list_display_video360_advertiser_link_proposals( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest], + Union[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse, + Awaitable[ + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse + ], + ], + ]: + raise NotImplementedError() + + @property + def create_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest], + Union[ + resources.DisplayVideo360AdvertiserLinkProposal, + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ], + ]: + raise NotImplementedError() + + @property + def delete_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest], + Union[empty_pb2.Empty, Awaitable[empty_pb2.Empty]], + ]: + raise NotImplementedError() + + @property + def approve_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest], + Union[ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse, + Awaitable[ + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ], + ], + ]: + raise NotImplementedError() + + @property + def cancel_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest], + Union[ + resources.DisplayVideo360AdvertiserLinkProposal, + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ], + ]: + raise NotImplementedError() + @property def create_custom_dimension( self, @@ -1153,5 +1334,27 @@ def get_custom_metric( ]: raise NotImplementedError() + @property + def get_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRetentionSettingsRequest], + Union[ + resources.DataRetentionSettings, Awaitable[resources.DataRetentionSettings] + ], + ]: + raise NotImplementedError() + + @property + def update_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRetentionSettingsRequest], + Union[ + resources.DataRetentionSettings, Awaitable[resources.DataRetentionSettings] + ], + ]: + raise NotImplementedError() + __all__ = ("AnalyticsAdminServiceTransport",) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py index f9cb77ecdb47..9dfa64f120f6 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py @@ -1324,32 +1324,6 @@ def create_firebase_link( ) return self._stubs["create_firebase_link"] - @property - def update_firebase_link( - self, - ) -> Callable[[analytics_admin.UpdateFirebaseLinkRequest], resources.FirebaseLink]: - r"""Return a callable for the update firebase link method over gRPC. - - Updates a FirebaseLink on a property - - Returns: - Callable[[~.UpdateFirebaseLinkRequest], - ~.FirebaseLink]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_firebase_link" not in self._stubs: - self._stubs["update_firebase_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateFirebaseLink", - request_serializer=analytics_admin.UpdateFirebaseLinkRequest.serialize, - response_deserializer=resources.FirebaseLink.deserialize, - ) - return self._stubs["update_firebase_link"] - @property def delete_firebase_link( self, @@ -1937,6 +1911,376 @@ def list_conversion_events( ) return self._stubs["list_conversion_events"] + @property + def get_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkRequest], + resources.DisplayVideo360AdvertiserLink, + ]: + r"""Return a callable for the get display video360 + advertiser link method over gRPC. + + Look up a single DisplayVideo360AdvertiserLink + + Returns: + Callable[[~.GetDisplayVideo360AdvertiserLinkRequest], + ~.DisplayVideo360AdvertiserLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "get_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["get_display_video360_advertiser_link"] + + @property + def list_display_video360_advertiser_links( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinksRequest], + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse, + ]: + r"""Return a callable for the list display video360 + advertiser links method over gRPC. + + Lists all DisplayVideo360AdvertiserLinks on a + property. + + Returns: + Callable[[~.ListDisplayVideo360AdvertiserLinksRequest], + ~.ListDisplayVideo360AdvertiserLinksResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_display_video360_advertiser_links" not in self._stubs: + self._stubs[ + "list_display_video360_advertiser_links" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinks", + request_serializer=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest.serialize, + response_deserializer=analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.deserialize, + ) + return self._stubs["list_display_video360_advertiser_links"] + + @property + def create_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest], + resources.DisplayVideo360AdvertiserLink, + ]: + r"""Return a callable for the create display video360 + advertiser link method over gRPC. + + Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. + + Returns: + Callable[[~.CreateDisplayVideo360AdvertiserLinkRequest], + ~.DisplayVideo360AdvertiserLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "create_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["create_display_video360_advertiser_link"] + + @property + def delete_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest], empty_pb2.Empty + ]: + r"""Return a callable for the delete display video360 + advertiser link method over gRPC. + + Deletes a DisplayVideo360AdvertiserLink on a + property. + + Returns: + Callable[[~.DeleteDisplayVideo360AdvertiserLinkRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "delete_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_display_video360_advertiser_link"] + + @property + def update_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest], + resources.DisplayVideo360AdvertiserLink, + ]: + r"""Return a callable for the update display video360 + advertiser link method over gRPC. + + Updates a DisplayVideo360AdvertiserLink on a + property. + + Returns: + Callable[[~.UpdateDisplayVideo360AdvertiserLinkRequest], + ~.DisplayVideo360AdvertiserLink]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "update_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["update_display_video360_advertiser_link"] + + @property + def get_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest], + resources.DisplayVideo360AdvertiserLinkProposal, + ]: + r"""Return a callable for the get display video360 + advertiser link proposal method over gRPC. + + Lookup for a single + DisplayVideo360AdvertiserLinkProposal. + + Returns: + Callable[[~.GetDisplayVideo360AdvertiserLinkProposalRequest], + ~.DisplayVideo360AdvertiserLinkProposal]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "get_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["get_display_video360_advertiser_link_proposal"] + + @property + def list_display_video360_advertiser_link_proposals( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest], + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse, + ]: + r"""Return a callable for the list display video360 + advertiser link proposals method over gRPC. + + Lists DisplayVideo360AdvertiserLinkProposals on a + property. + + Returns: + Callable[[~.ListDisplayVideo360AdvertiserLinkProposalsRequest], + ~.ListDisplayVideo360AdvertiserLinkProposalsResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_display_video360_advertiser_link_proposals" not in self._stubs: + self._stubs[ + "list_display_video360_advertiser_link_proposals" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinkProposals", + request_serializer=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest.serialize, + response_deserializer=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.deserialize, + ) + return self._stubs["list_display_video360_advertiser_link_proposals"] + + @property + def create_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest], + resources.DisplayVideo360AdvertiserLinkProposal, + ]: + r"""Return a callable for the create display video360 + advertiser link proposal method over gRPC. + + Creates a DisplayVideo360AdvertiserLinkProposal. + + Returns: + Callable[[~.CreateDisplayVideo360AdvertiserLinkProposalRequest], + ~.DisplayVideo360AdvertiserLinkProposal]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "create_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["create_display_video360_advertiser_link_proposal"] + + @property + def delete_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest], + empty_pb2.Empty, + ]: + r"""Return a callable for the delete display video360 + advertiser link proposal method over gRPC. + + Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. + + Returns: + Callable[[~.DeleteDisplayVideo360AdvertiserLinkProposalRequest], + ~.Empty]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "delete_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_display_video360_advertiser_link_proposal"] + + @property + def approve_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest], + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse, + ]: + r"""Return a callable for the approve display video360 + advertiser link proposal method over gRPC. + + Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. + + Returns: + Callable[[~.ApproveDisplayVideo360AdvertiserLinkProposalRequest], + ~.ApproveDisplayVideo360AdvertiserLinkProposalResponse]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "approve_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "approve_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ApproveDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.deserialize, + ) + return self._stubs["approve_display_video360_advertiser_link_proposal"] + + @property + def cancel_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest], + resources.DisplayVideo360AdvertiserLinkProposal, + ]: + r"""Return a callable for the cancel display video360 + advertiser link proposal method over gRPC. + + Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + - Declining a proposal initiated from Display & Video + 360 - Withdrawing a proposal initiated from Google + Analytics After being cancelled, a proposal will + eventually be deleted automatically. + + Returns: + Callable[[~.CancelDisplayVideo360AdvertiserLinkProposalRequest], + ~.DisplayVideo360AdvertiserLinkProposal]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "cancel_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CancelDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["cancel_display_video360_advertiser_link_proposal"] + @property def create_custom_dimension( self, @@ -2209,5 +2553,67 @@ def get_custom_metric( ) return self._stubs["get_custom_metric"] + @property + def get_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRetentionSettingsRequest], + resources.DataRetentionSettings, + ]: + r"""Return a callable for the get data retention settings method over gRPC. + + Returns the singleton data retention settings for + this property. + + Returns: + Callable[[~.GetDataRetentionSettingsRequest], + ~.DataRetentionSettings]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_data_retention_settings" not in self._stubs: + self._stubs["get_data_retention_settings"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataRetentionSettings", + request_serializer=analytics_admin.GetDataRetentionSettingsRequest.serialize, + response_deserializer=resources.DataRetentionSettings.deserialize, + ) + return self._stubs["get_data_retention_settings"] + + @property + def update_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRetentionSettingsRequest], + resources.DataRetentionSettings, + ]: + r"""Return a callable for the update data retention settings method over gRPC. + + Updates the singleton data retention settings for + this property. + + Returns: + Callable[[~.UpdateDataRetentionSettingsRequest], + ~.DataRetentionSettings]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_data_retention_settings" not in self._stubs: + self._stubs[ + "update_data_retention_settings" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataRetentionSettings", + request_serializer=analytics_admin.UpdateDataRetentionSettingsRequest.serialize, + response_deserializer=resources.DataRetentionSettings.deserialize, + ) + return self._stubs["update_data_retention_settings"] + __all__ = ("AnalyticsAdminServiceGrpcTransport",) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py index cd7d004c43cb..c4087bb76313 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py @@ -1356,34 +1356,6 @@ def create_firebase_link( ) return self._stubs["create_firebase_link"] - @property - def update_firebase_link( - self, - ) -> Callable[ - [analytics_admin.UpdateFirebaseLinkRequest], Awaitable[resources.FirebaseLink] - ]: - r"""Return a callable for the update firebase link method over gRPC. - - Updates a FirebaseLink on a property - - Returns: - Callable[[~.UpdateFirebaseLinkRequest], - Awaitable[~.FirebaseLink]]: - A function that, when called, will call the underlying RPC - on the server. - """ - # Generate a "stub function" on-the-fly which will actually make - # the request. - # gRPC handles serialization and deserialization, so we just need - # to pass in the functions for each. - if "update_firebase_link" not in self._stubs: - self._stubs["update_firebase_link"] = self.grpc_channel.unary_unary( - "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateFirebaseLink", - request_serializer=analytics_admin.UpdateFirebaseLinkRequest.serialize, - response_deserializer=resources.FirebaseLink.deserialize, - ) - return self._stubs["update_firebase_link"] - @property def delete_firebase_link( self, @@ -1983,6 +1955,377 @@ def list_conversion_events( ) return self._stubs["list_conversion_events"] + @property + def get_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkRequest], + Awaitable[resources.DisplayVideo360AdvertiserLink], + ]: + r"""Return a callable for the get display video360 + advertiser link method over gRPC. + + Look up a single DisplayVideo360AdvertiserLink + + Returns: + Callable[[~.GetDisplayVideo360AdvertiserLinkRequest], + Awaitable[~.DisplayVideo360AdvertiserLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "get_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["get_display_video360_advertiser_link"] + + @property + def list_display_video360_advertiser_links( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinksRequest], + Awaitable[analytics_admin.ListDisplayVideo360AdvertiserLinksResponse], + ]: + r"""Return a callable for the list display video360 + advertiser links method over gRPC. + + Lists all DisplayVideo360AdvertiserLinks on a + property. + + Returns: + Callable[[~.ListDisplayVideo360AdvertiserLinksRequest], + Awaitable[~.ListDisplayVideo360AdvertiserLinksResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_display_video360_advertiser_links" not in self._stubs: + self._stubs[ + "list_display_video360_advertiser_links" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinks", + request_serializer=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest.serialize, + response_deserializer=analytics_admin.ListDisplayVideo360AdvertiserLinksResponse.deserialize, + ) + return self._stubs["list_display_video360_advertiser_links"] + + @property + def create_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest], + Awaitable[resources.DisplayVideo360AdvertiserLink], + ]: + r"""Return a callable for the create display video360 + advertiser link method over gRPC. + + Creates a DisplayVideo360AdvertiserLink. + This can only be utilized by users who have proper + authorization both on the Google Analytics property and + on the Display & Video 360 advertiser. Users who do not + have access to the Display & Video 360 advertiser should + instead seek to create a DisplayVideo360LinkProposal. + + Returns: + Callable[[~.CreateDisplayVideo360AdvertiserLinkRequest], + Awaitable[~.DisplayVideo360AdvertiserLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "create_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["create_display_video360_advertiser_link"] + + @property + def delete_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest], + Awaitable[empty_pb2.Empty], + ]: + r"""Return a callable for the delete display video360 + advertiser link method over gRPC. + + Deletes a DisplayVideo360AdvertiserLink on a + property. + + Returns: + Callable[[~.DeleteDisplayVideo360AdvertiserLinkRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "delete_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_display_video360_advertiser_link"] + + @property + def update_display_video360_advertiser_link( + self, + ) -> Callable[ + [analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest], + Awaitable[resources.DisplayVideo360AdvertiserLink], + ]: + r"""Return a callable for the update display video360 + advertiser link method over gRPC. + + Updates a DisplayVideo360AdvertiserLink on a + property. + + Returns: + Callable[[~.UpdateDisplayVideo360AdvertiserLinkRequest], + Awaitable[~.DisplayVideo360AdvertiserLink]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_display_video360_advertiser_link" not in self._stubs: + self._stubs[ + "update_display_video360_advertiser_link" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDisplayVideo360AdvertiserLink", + request_serializer=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLink.deserialize, + ) + return self._stubs["update_display_video360_advertiser_link"] + + @property + def get_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ]: + r"""Return a callable for the get display video360 + advertiser link proposal method over gRPC. + + Lookup for a single + DisplayVideo360AdvertiserLinkProposal. + + Returns: + Callable[[~.GetDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[~.DisplayVideo360AdvertiserLinkProposal]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "get_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["get_display_video360_advertiser_link_proposal"] + + @property + def list_display_video360_advertiser_link_proposals( + self, + ) -> Callable[ + [analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest], + Awaitable[analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse], + ]: + r"""Return a callable for the list display video360 + advertiser link proposals method over gRPC. + + Lists DisplayVideo360AdvertiserLinkProposals on a + property. + + Returns: + Callable[[~.ListDisplayVideo360AdvertiserLinkProposalsRequest], + Awaitable[~.ListDisplayVideo360AdvertiserLinkProposalsResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "list_display_video360_advertiser_link_proposals" not in self._stubs: + self._stubs[ + "list_display_video360_advertiser_link_proposals" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ListDisplayVideo360AdvertiserLinkProposals", + request_serializer=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest.serialize, + response_deserializer=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse.deserialize, + ) + return self._stubs["list_display_video360_advertiser_link_proposals"] + + @property + def create_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ]: + r"""Return a callable for the create display video360 + advertiser link proposal method over gRPC. + + Creates a DisplayVideo360AdvertiserLinkProposal. + + Returns: + Callable[[~.CreateDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[~.DisplayVideo360AdvertiserLinkProposal]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "create_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "create_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CreateDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["create_display_video360_advertiser_link_proposal"] + + @property + def delete_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[empty_pb2.Empty], + ]: + r"""Return a callable for the delete display video360 + advertiser link proposal method over gRPC. + + Deletes a DisplayVideo360AdvertiserLinkProposal on a + property. This can only be used on cancelled proposals. + + Returns: + Callable[[~.DeleteDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[~.Empty]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "delete_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "delete_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/DeleteDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=empty_pb2.Empty.FromString, + ) + return self._stubs["delete_display_video360_advertiser_link_proposal"] + + @property + def approve_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse], + ]: + r"""Return a callable for the approve display video360 + advertiser link proposal method over gRPC. + + Approves a DisplayVideo360AdvertiserLinkProposal. + The DisplayVideo360AdvertiserLinkProposal will be + deleted and a new DisplayVideo360AdvertiserLink will be + created. + + Returns: + Callable[[~.ApproveDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[~.ApproveDisplayVideo360AdvertiserLinkProposalResponse]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "approve_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "approve_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/ApproveDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse.deserialize, + ) + return self._stubs["approve_display_video360_advertiser_link_proposal"] + + @property + def cancel_display_video360_advertiser_link_proposal( + self, + ) -> Callable[ + [analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[resources.DisplayVideo360AdvertiserLinkProposal], + ]: + r"""Return a callable for the cancel display video360 + advertiser link proposal method over gRPC. + + Cancels a DisplayVideo360AdvertiserLinkProposal. + Cancelling can mean either: + - Declining a proposal initiated from Display & Video + 360 - Withdrawing a proposal initiated from Google + Analytics After being cancelled, a proposal will + eventually be deleted automatically. + + Returns: + Callable[[~.CancelDisplayVideo360AdvertiserLinkProposalRequest], + Awaitable[~.DisplayVideo360AdvertiserLinkProposal]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "cancel_display_video360_advertiser_link_proposal" not in self._stubs: + self._stubs[ + "cancel_display_video360_advertiser_link_proposal" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/CancelDisplayVideo360AdvertiserLinkProposal", + request_serializer=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest.serialize, + response_deserializer=resources.DisplayVideo360AdvertiserLinkProposal.deserialize, + ) + return self._stubs["cancel_display_video360_advertiser_link_proposal"] + @property def create_custom_dimension( self, @@ -2268,5 +2611,67 @@ def get_custom_metric( ) return self._stubs["get_custom_metric"] + @property + def get_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.GetDataRetentionSettingsRequest], + Awaitable[resources.DataRetentionSettings], + ]: + r"""Return a callable for the get data retention settings method over gRPC. + + Returns the singleton data retention settings for + this property. + + Returns: + Callable[[~.GetDataRetentionSettingsRequest], + Awaitable[~.DataRetentionSettings]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "get_data_retention_settings" not in self._stubs: + self._stubs["get_data_retention_settings"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/GetDataRetentionSettings", + request_serializer=analytics_admin.GetDataRetentionSettingsRequest.serialize, + response_deserializer=resources.DataRetentionSettings.deserialize, + ) + return self._stubs["get_data_retention_settings"] + + @property + def update_data_retention_settings( + self, + ) -> Callable[ + [analytics_admin.UpdateDataRetentionSettingsRequest], + Awaitable[resources.DataRetentionSettings], + ]: + r"""Return a callable for the update data retention settings method over gRPC. + + Updates the singleton data retention settings for + this property. + + Returns: + Callable[[~.UpdateDataRetentionSettingsRequest], + Awaitable[~.DataRetentionSettings]]: + A function that, when called, will call the underlying RPC + on the server. + """ + # Generate a "stub function" on-the-fly which will actually make + # the request. + # gRPC handles serialization and deserialization, so we just need + # to pass in the functions for each. + if "update_data_retention_settings" not in self._stubs: + self._stubs[ + "update_data_retention_settings" + ] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateDataRetentionSettings", + request_serializer=analytics_admin.UpdateDataRetentionSettingsRequest.serialize, + response_deserializer=resources.DataRetentionSettings.deserialize, + ) + return self._stubs["update_data_retention_settings"] + __all__ = ("AnalyticsAdminServiceGrpcAsyncIOTransport",) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/__init__.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/__init__.py index 11c0bcf0e342..b1e8850f85d7 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/__init__.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/__init__.py @@ -14,6 +14,8 @@ # limitations under the License. # from .analytics_admin import ( + ApproveDisplayVideo360AdvertiserLinkProposalRequest, + ApproveDisplayVideo360AdvertiserLinkProposalResponse, ArchiveCustomDimensionRequest, ArchiveCustomMetricRequest, AuditUserLinksRequest, @@ -25,9 +27,12 @@ BatchGetUserLinksResponse, BatchUpdateUserLinksRequest, BatchUpdateUserLinksResponse, + CancelDisplayVideo360AdvertiserLinkProposalRequest, CreateConversionEventRequest, CreateCustomDimensionRequest, CreateCustomMetricRequest, + CreateDisplayVideo360AdvertiserLinkProposalRequest, + CreateDisplayVideo360AdvertiserLinkRequest, CreateFirebaseLinkRequest, CreateGoogleAdsLinkRequest, CreateMeasurementProtocolSecretRequest, @@ -37,6 +42,8 @@ DeleteAccountRequest, DeleteAndroidAppDataStreamRequest, DeleteConversionEventRequest, + DeleteDisplayVideo360AdvertiserLinkProposalRequest, + DeleteDisplayVideo360AdvertiserLinkRequest, DeleteFirebaseLinkRequest, DeleteGoogleAdsLinkRequest, DeleteIosAppDataStreamRequest, @@ -49,7 +56,10 @@ GetConversionEventRequest, GetCustomDimensionRequest, GetCustomMetricRequest, + GetDataRetentionSettingsRequest, GetDataSharingSettingsRequest, + GetDisplayVideo360AdvertiserLinkProposalRequest, + GetDisplayVideo360AdvertiserLinkRequest, GetEnhancedMeasurementSettingsRequest, GetGlobalSiteTagRequest, GetGoogleSignalsSettingsRequest, @@ -70,6 +80,10 @@ ListCustomDimensionsResponse, ListCustomMetricsRequest, ListCustomMetricsResponse, + ListDisplayVideo360AdvertiserLinkProposalsRequest, + ListDisplayVideo360AdvertiserLinkProposalsResponse, + ListDisplayVideo360AdvertiserLinksRequest, + ListDisplayVideo360AdvertiserLinksResponse, ListFirebaseLinksRequest, ListFirebaseLinksResponse, ListGoogleAdsLinksRequest, @@ -92,8 +106,9 @@ UpdateAndroidAppDataStreamRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, + UpdateDataRetentionSettingsRequest, + UpdateDisplayVideo360AdvertiserLinkRequest, UpdateEnhancedMeasurementSettingsRequest, - UpdateFirebaseLinkRequest, UpdateGoogleAdsLinkRequest, UpdateGoogleSignalsSettingsRequest, UpdateIosAppDataStreamRequest, @@ -112,13 +127,17 @@ ConversionEvent, CustomDimension, CustomMetric, + DataRetentionSettings, DataSharingSettings, + DisplayVideo360AdvertiserLink, + DisplayVideo360AdvertiserLinkProposal, EnhancedMeasurementSettings, FirebaseLink, GlobalSiteTag, GoogleAdsLink, GoogleSignalsSettings, IosAppDataStream, + LinkProposalStatusDetails, MeasurementProtocolSecret, Property, PropertySummary, @@ -130,10 +149,14 @@ GoogleSignalsConsent, GoogleSignalsState, IndustryCategory, - MaximumUserAccess, + LinkProposalInitiatingProduct, + LinkProposalState, + ServiceLevel, ) __all__ = ( + "ApproveDisplayVideo360AdvertiserLinkProposalRequest", + "ApproveDisplayVideo360AdvertiserLinkProposalResponse", "ArchiveCustomDimensionRequest", "ArchiveCustomMetricRequest", "AuditUserLinksRequest", @@ -145,9 +168,12 @@ "BatchGetUserLinksResponse", "BatchUpdateUserLinksRequest", "BatchUpdateUserLinksResponse", + "CancelDisplayVideo360AdvertiserLinkProposalRequest", "CreateConversionEventRequest", "CreateCustomDimensionRequest", "CreateCustomMetricRequest", + "CreateDisplayVideo360AdvertiserLinkProposalRequest", + "CreateDisplayVideo360AdvertiserLinkRequest", "CreateFirebaseLinkRequest", "CreateGoogleAdsLinkRequest", "CreateMeasurementProtocolSecretRequest", @@ -157,6 +183,8 @@ "DeleteAccountRequest", "DeleteAndroidAppDataStreamRequest", "DeleteConversionEventRequest", + "DeleteDisplayVideo360AdvertiserLinkProposalRequest", + "DeleteDisplayVideo360AdvertiserLinkRequest", "DeleteFirebaseLinkRequest", "DeleteGoogleAdsLinkRequest", "DeleteIosAppDataStreamRequest", @@ -169,7 +197,10 @@ "GetConversionEventRequest", "GetCustomDimensionRequest", "GetCustomMetricRequest", + "GetDataRetentionSettingsRequest", "GetDataSharingSettingsRequest", + "GetDisplayVideo360AdvertiserLinkProposalRequest", + "GetDisplayVideo360AdvertiserLinkRequest", "GetEnhancedMeasurementSettingsRequest", "GetGlobalSiteTagRequest", "GetGoogleSignalsSettingsRequest", @@ -190,6 +221,10 @@ "ListCustomDimensionsResponse", "ListCustomMetricsRequest", "ListCustomMetricsResponse", + "ListDisplayVideo360AdvertiserLinkProposalsRequest", + "ListDisplayVideo360AdvertiserLinkProposalsResponse", + "ListDisplayVideo360AdvertiserLinksRequest", + "ListDisplayVideo360AdvertiserLinksResponse", "ListFirebaseLinksRequest", "ListFirebaseLinksResponse", "ListGoogleAdsLinksRequest", @@ -212,8 +247,9 @@ "UpdateAndroidAppDataStreamRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", + "UpdateDataRetentionSettingsRequest", + "UpdateDisplayVideo360AdvertiserLinkRequest", "UpdateEnhancedMeasurementSettingsRequest", - "UpdateFirebaseLinkRequest", "UpdateGoogleAdsLinkRequest", "UpdateGoogleSignalsSettingsRequest", "UpdateIosAppDataStreamRequest", @@ -230,13 +266,17 @@ "ConversionEvent", "CustomDimension", "CustomMetric", + "DataRetentionSettings", "DataSharingSettings", + "DisplayVideo360AdvertiserLink", + "DisplayVideo360AdvertiserLinkProposal", "EnhancedMeasurementSettings", "FirebaseLink", "GlobalSiteTag", "GoogleAdsLink", "GoogleSignalsSettings", "IosAppDataStream", + "LinkProposalStatusDetails", "MeasurementProtocolSecret", "Property", "PropertySummary", @@ -248,5 +288,7 @@ "GoogleSignalsConsent", "GoogleSignalsState", "IndustryCategory", - "MaximumUserAccess", + "LinkProposalInitiatingProduct", + "LinkProposalState", + "ServiceLevel", ) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/analytics_admin.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/analytics_admin.py index de15ce1e2afd..38099963424c 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/analytics_admin.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/analytics_admin.py @@ -70,7 +70,6 @@ "GetEnhancedMeasurementSettingsRequest", "UpdateEnhancedMeasurementSettingsRequest", "CreateFirebaseLinkRequest", - "UpdateFirebaseLinkRequest", "DeleteFirebaseLinkRequest", "ListFirebaseLinksRequest", "ListFirebaseLinksResponse", @@ -98,6 +97,20 @@ "DeleteConversionEventRequest", "ListConversionEventsRequest", "ListConversionEventsResponse", + "GetDisplayVideo360AdvertiserLinkRequest", + "ListDisplayVideo360AdvertiserLinksRequest", + "ListDisplayVideo360AdvertiserLinksResponse", + "CreateDisplayVideo360AdvertiserLinkRequest", + "DeleteDisplayVideo360AdvertiserLinkRequest", + "UpdateDisplayVideo360AdvertiserLinkRequest", + "GetDisplayVideo360AdvertiserLinkProposalRequest", + "ListDisplayVideo360AdvertiserLinkProposalsRequest", + "ListDisplayVideo360AdvertiserLinkProposalsResponse", + "CreateDisplayVideo360AdvertiserLinkProposalRequest", + "DeleteDisplayVideo360AdvertiserLinkProposalRequest", + "ApproveDisplayVideo360AdvertiserLinkProposalRequest", + "ApproveDisplayVideo360AdvertiserLinkProposalResponse", + "CancelDisplayVideo360AdvertiserLinkProposalRequest", "CreateCustomDimensionRequest", "UpdateCustomDimensionRequest", "ListCustomDimensionsRequest", @@ -110,6 +123,8 @@ "ListCustomMetricsResponse", "ArchiveCustomMetricRequest", "GetCustomMetricRequest", + "GetDataRetentionSettingsRequest", + "UpdateDataRetentionSettingsRequest", }, ) @@ -971,26 +986,6 @@ class CreateFirebaseLinkRequest(proto.Message): ) -class UpdateFirebaseLinkRequest(proto.Message): - r"""Request message for UpdateFirebaseLink RPC - Attributes: - firebase_link (google.analytics.admin_v1alpha.types.FirebaseLink): - Required. The Firebase link to update. - update_mask (google.protobuf.field_mask_pb2.FieldMask): - Required. The list of fields to be updated. Field names must - be in snake case (e.g., "field_to_update"). Omitted fields - will not be updated. To replace the entire entity, use one - path with the string "*" to match all fields. - """ - - firebase_link = proto.Field( - proto.MESSAGE, number=1, message=resources.FirebaseLink, - ) - update_mask = proto.Field( - proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, - ) - - class DeleteFirebaseLinkRequest(proto.Message): r"""Request message for DeleteFirebaseLink RPC Attributes: @@ -1534,6 +1529,261 @@ def raw_page(self): next_page_token = proto.Field(proto.STRING, number=2,) +class GetDisplayVideo360AdvertiserLinkRequest(proto.Message): + r"""Request message for GetDisplayVideo360AdvertiserLink RPC. + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLink to get. Example + format: + properties/1234/displayVideo360AdvertiserLink/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + +class ListDisplayVideo360AdvertiserLinksRequest(proto.Message): + r"""Request message for ListDisplayVideo360AdvertiserLinks RPC. + Attributes: + parent (str): + Required. Example format: properties/1234 + page_size (int): + 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). + page_token (str): + A page token, received from a previous + ``ListDisplayVideo360AdvertiserLinks`` call. Provide this to + retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListDisplayVideo360AdvertiserLinks`` must match the call + that provided the page token. + """ + + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) + + +class ListDisplayVideo360AdvertiserLinksResponse(proto.Message): + r"""Response message for ListDisplayVideo360AdvertiserLinks RPC. + Attributes: + display_video_360_advertiser_links (Sequence[google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink]): + List of DisplayVideo360AdvertiserLinks. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + display_video_360_advertiser_links = proto.RepeatedField( + proto.MESSAGE, number=1, message=resources.DisplayVideo360AdvertiserLink, + ) + next_page_token = proto.Field(proto.STRING, number=2,) + + +class CreateDisplayVideo360AdvertiserLinkRequest(proto.Message): + r"""Request message for CreateDisplayVideo360AdvertiserLink RPC. + Attributes: + parent (str): + Required. Example format: properties/1234 + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + Required. The DisplayVideo360AdvertiserLink + to create. + """ + + parent = proto.Field(proto.STRING, number=1,) + display_video_360_advertiser_link = proto.Field( + proto.MESSAGE, number=2, message=resources.DisplayVideo360AdvertiserLink, + ) + + +class DeleteDisplayVideo360AdvertiserLinkRequest(proto.Message): + r"""Request message for DeleteDisplayVideo360AdvertiserLink RPC. + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLink to delete. Example + format: + properties/1234/displayVideo360AdvertiserLinks/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + +class UpdateDisplayVideo360AdvertiserLinkRequest(proto.Message): + r"""Request message for UpdateDisplayVideo360AdvertiserLink RPC. + Attributes: + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + The DisplayVideo360AdvertiserLink to update + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Omitted fields + will not be updated. To replace the entire entity, use one + path with the string "*" to match all fields. + """ + + display_video_360_advertiser_link = proto.Field( + proto.MESSAGE, number=1, message=resources.DisplayVideo360AdvertiserLink, + ) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + + +class GetDisplayVideo360AdvertiserLinkProposalRequest(proto.Message): + r"""Request message for GetDisplayVideo360AdvertiserLinkProposal + RPC. + + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to get. + Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + +class ListDisplayVideo360AdvertiserLinkProposalsRequest(proto.Message): + r"""Request message for + ListDisplayVideo360AdvertiserLinkProposals RPC. + + Attributes: + parent (str): + Required. Example format: properties/1234 + page_size (int): + 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). + page_token (str): + A page token, received from a previous + ``ListDisplayVideo360AdvertiserLinkProposals`` call. Provide + this to retrieve the subsequent page. + + When paginating, all other parameters provided to + ``ListDisplayVideo360AdvertiserLinkProposals`` must match + the call that provided the page token. + """ + + parent = proto.Field(proto.STRING, number=1,) + page_size = proto.Field(proto.INT32, number=2,) + page_token = proto.Field(proto.STRING, number=3,) + + +class ListDisplayVideo360AdvertiserLinkProposalsResponse(proto.Message): + r"""Response message for + ListDisplayVideo360AdvertiserLinkProposals RPC. + + Attributes: + display_video_360_advertiser_link_proposals (Sequence[google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal]): + List of + DisplayVideo360AdvertiserLinkProposals. + next_page_token (str): + A token, which can be sent as ``page_token`` to retrieve the + next page. If this field is omitted, there are no subsequent + pages. + """ + + @property + def raw_page(self): + return self + + display_video_360_advertiser_link_proposals = proto.RepeatedField( + proto.MESSAGE, + number=1, + message=resources.DisplayVideo360AdvertiserLinkProposal, + ) + next_page_token = proto.Field(proto.STRING, number=2,) + + +class CreateDisplayVideo360AdvertiserLinkProposalRequest(proto.Message): + r"""Request message for + CreateDisplayVideo360AdvertiserLinkProposal RPC. + + Attributes: + parent (str): + Required. Example format: properties/1234 + display_video_360_advertiser_link_proposal (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal): + Required. The + DisplayVideo360AdvertiserLinkProposal to create. + """ + + parent = proto.Field(proto.STRING, number=1,) + display_video_360_advertiser_link_proposal = proto.Field( + proto.MESSAGE, + number=2, + message=resources.DisplayVideo360AdvertiserLinkProposal, + ) + + +class DeleteDisplayVideo360AdvertiserLinkProposalRequest(proto.Message): + r"""Request message for + DeleteDisplayVideo360AdvertiserLinkProposal RPC. + + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to delete. + Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + +class ApproveDisplayVideo360AdvertiserLinkProposalRequest(proto.Message): + r"""Request message for + ApproveDisplayVideo360AdvertiserLinkProposal RPC. + + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to + approve. Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + +class ApproveDisplayVideo360AdvertiserLinkProposalResponse(proto.Message): + r"""Response message for + ApproveDisplayVideo360AdvertiserLinkProposal RPC. + + Attributes: + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + The DisplayVideo360AdvertiserLink created as + a result of approving the proposal. + """ + + display_video_360_advertiser_link = proto.Field( + proto.MESSAGE, number=1, message=resources.DisplayVideo360AdvertiserLink, + ) + + +class CancelDisplayVideo360AdvertiserLinkProposalRequest(proto.Message): + r"""Request message for + CancelDisplayVideo360AdvertiserLinkProposal RPC. + + Attributes: + name (str): + Required. The name of the + DisplayVideo360AdvertiserLinkProposal to cancel. + Example format: + properties/1234/displayVideo360AdvertiserLinkProposals/5678 + """ + + name = proto.Field(proto.STRING, number=1,) + + class CreateCustomDimensionRequest(proto.Message): r"""Request message for CreateCustomDimension RPC. Attributes: @@ -1741,4 +1991,38 @@ class GetCustomMetricRequest(proto.Message): name = proto.Field(proto.STRING, number=1,) +class GetDataRetentionSettingsRequest(proto.Message): + r"""Request message for GetDataRetentionSettings RPC. + Attributes: + name (str): + Required. The name of the settings to lookup. + Format: + properties/{property}/dataRetentionSettings + Example: "properties/1000/dataRetentionSettings". + """ + + name = proto.Field(proto.STRING, number=1,) + + +class UpdateDataRetentionSettingsRequest(proto.Message): + r"""Request message for UpdateDataRetentionSettings RPC. + Attributes: + data_retention_settings (google.analytics.admin_v1alpha.types.DataRetentionSettings): + Required. The settings to update. The ``name`` field is used + to identify the settings to be updated. + update_mask (google.protobuf.field_mask_pb2.FieldMask): + Required. The list of fields to be updated. Field names must + be in snake case (e.g., "field_to_update"). Omitted fields + will not be updated. To replace the entire entity, use one + path with the string "*" to match all fields. + """ + + data_retention_settings = proto.Field( + proto.MESSAGE, number=1, message=resources.DataRetentionSettings, + ) + update_mask = proto.Field( + proto.MESSAGE, number=2, message=field_mask_pb2.FieldMask, + ) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/resources.py b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/resources.py index 1af1d10838eb..1d1057c7c686 100644 --- a/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/resources.py +++ b/packages/google-analytics-admin/google/analytics/admin_v1alpha/types/resources.py @@ -22,13 +22,15 @@ __protobuf__ = proto.module( package="google.analytics.admin.v1alpha", manifest={ - "MaximumUserAccess", "IndustryCategory", + "ServiceLevel", "ActorType", "ActionType", "ChangeHistoryResourceType", "GoogleSignalsState", "GoogleSignalsConsent", + "LinkProposalInitiatingProduct", + "LinkProposalState", "Account", "Property", "AndroidAppDataStream", @@ -46,25 +48,18 @@ "MeasurementProtocolSecret", "ChangeHistoryEvent", "ChangeHistoryChange", + "DisplayVideo360AdvertiserLink", + "DisplayVideo360AdvertiserLinkProposal", + "LinkProposalStatusDetails", "ConversionEvent", "GoogleSignalsSettings", "CustomDimension", "CustomMetric", + "DataRetentionSettings", }, ) -class MaximumUserAccess(proto.Enum): - r"""Maximum access settings that Firebase user receive on the - linked Analytics property. - """ - MAXIMUM_USER_ACCESS_UNSPECIFIED = 0 - NO_ACCESS = 1 - READ_AND_ANALYZE = 2 - EDITOR_WITHOUT_LINK_MANAGEMENT = 3 - EDITOR_INCLUDING_LINK_MANAGEMENT = 4 - - class IndustryCategory(proto.Enum): r"""The category selected for this property, used for industry benchmarking. @@ -98,6 +93,13 @@ class IndustryCategory(proto.Enum): SHOPPING = 26 +class ServiceLevel(proto.Enum): + r"""Various levels of service for Google Analytics.""" + SERVICE_LEVEL_UNSPECIFIED = 0 + GOOGLE_ANALYTICS_STANDARD = 1 + GOOGLE_ANALYTICS_360 = 2 + + class ActorType(proto.Enum): r"""Different kinds of actors that can make changes to Google Analytics resources. @@ -133,6 +135,7 @@ class ChangeHistoryResourceType(proto.Enum): MEASUREMENT_PROTOCOL_SECRET = 10 CUSTOM_DIMENSION = 11 CUSTOM_METRIC = 12 + DATA_RETENTION_SETTINGS = 13 class GoogleSignalsState(proto.Enum): @@ -153,6 +156,26 @@ class GoogleSignalsConsent(proto.Enum): GOOGLE_SIGNALS_CONSENT_NOT_CONSENTED = 1 +class LinkProposalInitiatingProduct(proto.Enum): + r"""An indication of which product the user initiated a link + proposal from. + """ + LINK_PROPOSAL_INITIATING_PRODUCT_UNSPECIFIED = 0 + GOOGLE_ANALYTICS = 1 + LINKED_PRODUCT = 2 + + +class LinkProposalState(proto.Enum): + r"""The state of a link proposal resource.""" + LINK_PROPOSAL_STATE_UNSPECIFIED = 0 + AWAITING_REVIEW_FROM_GOOGLE_ANALYTICS = 1 + AWAITING_REVIEW_FROM_LINKED_PRODUCT = 2 + WITHDRAWN = 3 + DECLINED = 4 + EXPIRED = 5 + OBSOLETE = 6 + + class Account(proto.Message): r"""A resource message representing a Google Analytics account. Attributes: @@ -231,6 +254,9 @@ class Property(proto.Message): Format: https://en.wikipedia.org/wiki/ISO_4217 Examples: "USD", "EUR", "JPY". + service_level (google.analytics.admin_v1alpha.types.ServiceLevel): + Output only. The Google Analytics service + level that applies to this property. delete_time (google.protobuf.timestamp_pb2.Timestamp): Output only. If set, the time at which this property was trashed. If not set, then this @@ -250,6 +276,7 @@ class Property(proto.Message): industry_category = proto.Field(proto.ENUM, number=6, enum="IndustryCategory",) time_zone = proto.Field(proto.STRING, number=7,) currency_code = proto.Field(proto.STRING, number=8,) + service_level = proto.Field(proto.ENUM, number=10, enum="ServiceLevel",) delete_time = proto.Field( proto.MESSAGE, number=11, message=timestamp_pb2.Timestamp, ) @@ -526,16 +553,11 @@ class FirebaseLink(proto.Message): create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when this FirebaseLink was originally created. - maximum_user_access (google.analytics.admin_v1alpha.types.MaximumUserAccess): - Maximum user access to the GA4 property - allowed to admins of the linked Firebase - project. """ name = proto.Field(proto.STRING, number=1,) project = proto.Field(proto.STRING, number=2,) create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - maximum_user_access = proto.Field(proto.ENUM, number=4, enum="MaximumUserAccess",) class GlobalSiteTag(proto.Message): @@ -578,17 +600,17 @@ class GoogleAdsLink(proto.Message): linked Google Ads account. If this field is not set on create/update, it will be defaulted to true. - email_address (str): - 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. create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when this link was originally created. update_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when this link was last updated. + creator_email_address (str): + 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. """ name = proto.Field(proto.STRING, number=1,) @@ -597,9 +619,9 @@ class GoogleAdsLink(proto.Message): ads_personalization_enabled = proto.Field( proto.MESSAGE, number=5, message=wrappers_pb2.BoolValue, ) - email_address = proto.Field(proto.STRING, number=6,) create_time = proto.Field(proto.MESSAGE, number=7, message=timestamp_pb2.Timestamp,) update_time = proto.Field(proto.MESSAGE, number=8, message=timestamp_pb2.Timestamp,) + creator_email_address = proto.Field(proto.STRING, number=9,) class DataSharingSettings(proto.Message): @@ -798,6 +820,13 @@ class ChangeHistoryResource(proto.Message): google_signals_settings (google.analytics.admin_v1alpha.types.GoogleSignalsSettings): A snapshot of a GoogleSignalsSettings resource in change history. + display_video_360_advertiser_link (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLink): + A snapshot of a DisplayVideo360AdvertiserLink + resource in change history. + display_video_360_advertiser_link_proposal (google.analytics.admin_v1alpha.types.DisplayVideo360AdvertiserLinkProposal): + A snapshot of a + DisplayVideo360AdvertiserLinkProposal resource + in change history. conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): A snapshot of a ConversionEvent resource in change history. @@ -810,6 +839,9 @@ class ChangeHistoryResource(proto.Message): custom_metric (google.analytics.admin_v1alpha.types.CustomMetric): A snapshot of a CustomMetric resource in change history. + data_retention_settings (google.analytics.admin_v1alpha.types.DataRetentionSettings): + A snapshot of a data retention settings + resource in change history. """ account = proto.Field( @@ -836,6 +868,18 @@ class ChangeHistoryResource(proto.Message): google_signals_settings = proto.Field( proto.MESSAGE, number=8, oneof="resource", message="GoogleSignalsSettings", ) + display_video_360_advertiser_link = proto.Field( + proto.MESSAGE, + number=9, + oneof="resource", + message="DisplayVideo360AdvertiserLink", + ) + display_video_360_advertiser_link_proposal = proto.Field( + proto.MESSAGE, + number=10, + oneof="resource", + message="DisplayVideo360AdvertiserLinkProposal", + ) conversion_event = proto.Field( proto.MESSAGE, number=11, oneof="resource", message="ConversionEvent", ) @@ -851,6 +895,9 @@ class ChangeHistoryResource(proto.Message): custom_metric = proto.Field( proto.MESSAGE, number=14, oneof="resource", message="CustomMetric", ) + data_retention_settings = proto.Field( + proto.MESSAGE, number=15, oneof="resource", message="DataRetentionSettings", + ) resource = proto.Field(proto.STRING, number=1,) action = proto.Field(proto.ENUM, number=2, enum="ActionType",) @@ -862,6 +909,145 @@ class ChangeHistoryResource(proto.Message): ) +class DisplayVideo360AdvertiserLink(proto.Message): + r"""A link between a GA4 property and a Display & Video 360 + advertiser. + + Attributes: + name (str): + Output only. The resource name for this + DisplayVideo360AdvertiserLink resource. Format: + properties/{propertyId}/displayVideo360AdvertiserLinks/{linkId} + Note: linkId is not the Display & Video 360 + Advertiser ID + advertiser_id (str): + Immutable. The Display & Video 360 + Advertiser's advertiser ID. + advertiser_display_name (str): + Output only. The display name of the Display + & Video 360 Advertiser. + ads_personalization_enabled (google.protobuf.wrappers_pb2.BoolValue): + Enables personalized advertising features + with this integration. If this field is not set + on create/update, it will be defaulted to true. + campaign_data_sharing_enabled (google.protobuf.wrappers_pb2.BoolValue): + Immutable. Enables the import of campaign + data from Display & Video 360 into the GA4 + property. After link creation, this can only be + updated from the Display & Video 360 product. + If this field is not set on create, it will be + defaulted to true. + cost_data_sharing_enabled (google.protobuf.wrappers_pb2.BoolValue): + Immutable. Enables the import of cost data from Display & + Video 360 into the GA4 property. This can only be enabled if + campaign_data_import_enabled is enabled. After link + creation, this can only be updated from the Display & Video + 360 product. If this field is not set on create, it will be + defaulted to true. + """ + + name = proto.Field(proto.STRING, number=1,) + advertiser_id = proto.Field(proto.STRING, number=2,) + advertiser_display_name = proto.Field(proto.STRING, number=3,) + ads_personalization_enabled = proto.Field( + proto.MESSAGE, number=4, message=wrappers_pb2.BoolValue, + ) + campaign_data_sharing_enabled = proto.Field( + proto.MESSAGE, number=5, message=wrappers_pb2.BoolValue, + ) + cost_data_sharing_enabled = proto.Field( + proto.MESSAGE, number=6, message=wrappers_pb2.BoolValue, + ) + + +class DisplayVideo360AdvertiserLinkProposal(proto.Message): + r"""A proposal for a link between an GA4 property and a Display & + Video 360 advertiser. + + A proposal is converted to a DisplayVideo360AdvertiserLink once + approved. Google Analytics admins approve inbound proposals + while Display & Video 360 admins approve outbound proposals. + + Attributes: + name (str): + Output only. The resource name for this + DisplayVideo360AdvertiserLinkProposal resource. + Format: + properties/{propertyId}/displayVideo360AdvertiserLinkProposals/{proposalId} + Note: proposalId is not the Display & Video 360 + Advertiser ID + advertiser_id (str): + Immutable. The Display & Video 360 + Advertiser's advertiser ID. + link_proposal_status_details (google.analytics.admin_v1alpha.types.LinkProposalStatusDetails): + Output only. The status information for this + link proposal. + advertiser_display_name (str): + Output only. The display name of the Display + & Video Advertiser. Only populated for proposals + that originated from Display & Video 360. + validation_email (str): + Input only. On a proposal being sent to + Display & Video 360, this field must be set to + the email address of an admin on the target + advertiser. This is used to verify that the + Google Analytics admin is aware of at least one + admin on the Display & Video 360 Advertiser. + This does not restrict approval of the proposal + to a single user. Any admin on the Display & + Video 360 Advertiser may approve the proposal. + ads_personalization_enabled (google.protobuf.wrappers_pb2.BoolValue): + Immutable. Enables personalized advertising + features with this integration. If this field is + not set on create, it will be defaulted to true. + campaign_data_sharing_enabled (google.protobuf.wrappers_pb2.BoolValue): + Immutable. Enables the import of campaign + data from Display & Video 360. If this field is + not set on create, it will be defaulted to true. + cost_data_sharing_enabled (google.protobuf.wrappers_pb2.BoolValue): + Immutable. Enables the import of cost data from Display & + Video 360. This can only be enabled if + campaign_data_import_enabled is enabled. If this field is + not set on create, it will be defaulted to true. + """ + + name = proto.Field(proto.STRING, number=1,) + advertiser_id = proto.Field(proto.STRING, number=2,) + link_proposal_status_details = proto.Field( + proto.MESSAGE, number=3, message="LinkProposalStatusDetails", + ) + advertiser_display_name = proto.Field(proto.STRING, number=4,) + validation_email = proto.Field(proto.STRING, number=5,) + ads_personalization_enabled = proto.Field( + proto.MESSAGE, number=6, message=wrappers_pb2.BoolValue, + ) + campaign_data_sharing_enabled = proto.Field( + proto.MESSAGE, number=7, message=wrappers_pb2.BoolValue, + ) + cost_data_sharing_enabled = proto.Field( + proto.MESSAGE, number=8, message=wrappers_pb2.BoolValue, + ) + + +class LinkProposalStatusDetails(proto.Message): + r"""Status information for a link proposal. + Attributes: + link_proposal_initiating_product (google.analytics.admin_v1alpha.types.LinkProposalInitiatingProduct): + Output only. The source of this proposal. + requestor_email (str): + Output only. The email address of the user + that proposed this linkage. + link_proposal_state (google.analytics.admin_v1alpha.types.LinkProposalState): + Output only. The state of this proposal. + """ + + link_proposal_initiating_product = proto.Field( + proto.ENUM, number=1, enum="LinkProposalInitiatingProduct", + ) + requestor_email = proto.Field(proto.STRING, number=2,) + link_proposal_state = proto.Field(proto.ENUM, number=3, enum="LinkProposalState",) + + class ConversionEvent(proto.Message): r"""A conversion event in a Google Analytics property. Attributes: @@ -874,15 +1060,27 @@ class ConversionEvent(proto.Message): create_time (google.protobuf.timestamp_pb2.Timestamp): Output only. Time when this conversion event was created in the property. - is_deletable (bool): + deletable (bool): Output only. If set, this event can currently be deleted via DeleteConversionEvent. + custom (bool): + Output only. If set to true, this conversion + event refers to a custom event. If set to + false, this conversion event refers to a default + event in GA. Default events typically have + special meaning in GA. Default events are + usually created for you by the GA system, but in + some cases can be created by property admins. + Custom events count towards the maximum number + of custom conversion events that may be created + per property. """ name = proto.Field(proto.STRING, number=1,) event_name = proto.Field(proto.STRING, number=2,) create_time = proto.Field(proto.MESSAGE, number=3, message=timestamp_pb2.Timestamp,) - is_deletable = proto.Field(proto.BOOL, number=4,) + deletable = proto.Field(proto.BOOL, number=4,) + custom = proto.Field(proto.BOOL, number=5,) class GoogleSignalsSettings(proto.Message): @@ -987,8 +1185,8 @@ class CustomMetric(proto.Message): Optional. Description for this custom dimension. Max length of 150 characters. measurement_unit (google.analytics.admin_v1alpha.types.CustomMetric.MeasurementUnit): - Required. Immutable. The type for the custom - metric's value. + Required. The type for the custom metric's + value. scope (google.analytics.admin_v1alpha.types.CustomMetric.MetricScope): Required. Immutable. The scope of this custom metric. @@ -1024,4 +1222,35 @@ class MetricScope(proto.Enum): scope = proto.Field(proto.ENUM, number=6, enum=MetricScope,) +class DataRetentionSettings(proto.Message): + r"""Settings values for data retention. This is a singleton + resource. + + Attributes: + name (str): + Output only. Resource name for this + DataRetentionSetting resource. Format: + properties/{property}/dataRetentionSettings + event_data_retention (google.analytics.admin_v1alpha.types.DataRetentionSettings.RetentionDuration): + The length of time that event-level data is + retained. + reset_user_data_on_new_activity (bool): + If true, reset the retention period for the + user identifier with every event from that user. + """ + + class RetentionDuration(proto.Enum): + r"""Valid values for the data retention duration.""" + RETENTION_DURATION_UNSPECIFIED = 0 + TWO_MONTHS = 1 + FOURTEEN_MONTHS = 3 + TWENTY_SIX_MONTHS = 4 + THIRTY_EIGHT_MONTHS = 5 + FIFTY_MONTHS = 6 + + name = proto.Field(proto.STRING, number=1,) + event_data_retention = proto.Field(proto.ENUM, number=2, enum=RetentionDuration,) + reset_user_data_on_new_activity = proto.Field(proto.BOOL, number=3,) + + __all__ = tuple(sorted(__protobuf__.manifest)) diff --git a/packages/google-analytics-admin/scripts/fixup_admin_v1alpha_keywords.py b/packages/google-analytics-admin/scripts/fixup_admin_v1alpha_keywords.py index 24c3b61f8424..4e3d40dd7a2e 100644 --- a/packages/google-analytics-admin/scripts/fixup_admin_v1alpha_keywords.py +++ b/packages/google-analytics-admin/scripts/fixup_admin_v1alpha_keywords.py @@ -39,6 +39,7 @@ def partition( class adminCallTransformer(cst.CSTTransformer): CTRL_PARAMS: Tuple[str] = ('retry', 'timeout', 'metadata') METHOD_TO_PARAMS: Dict[str, Tuple[str]] = { + 'approve_display_video360_advertiser_link_proposal': ('name', ), 'archive_custom_dimension': ('name', ), 'archive_custom_metric': ('name', ), 'audit_user_links': ('parent', 'page_size', 'page_token', ), @@ -46,9 +47,12 @@ class adminCallTransformer(cst.CSTTransformer): 'batch_delete_user_links': ('parent', 'requests', ), 'batch_get_user_links': ('parent', 'names', ), 'batch_update_user_links': ('parent', 'requests', ), + 'cancel_display_video360_advertiser_link_proposal': ('name', ), 'create_conversion_event': ('conversion_event', 'parent', ), 'create_custom_dimension': ('parent', 'custom_dimension', ), 'create_custom_metric': ('parent', 'custom_metric', ), + 'create_display_video360_advertiser_link': ('parent', 'display_video_360_advertiser_link', ), + 'create_display_video360_advertiser_link_proposal': ('parent', 'display_video_360_advertiser_link_proposal', ), 'create_firebase_link': ('parent', 'firebase_link', ), 'create_google_ads_link': ('parent', 'google_ads_link', ), 'create_measurement_protocol_secret': ('parent', 'measurement_protocol_secret', ), @@ -58,6 +62,8 @@ class adminCallTransformer(cst.CSTTransformer): 'delete_account': ('name', ), 'delete_android_app_data_stream': ('name', ), 'delete_conversion_event': ('name', ), + 'delete_display_video360_advertiser_link': ('name', ), + 'delete_display_video360_advertiser_link_proposal': ('name', ), 'delete_firebase_link': ('name', ), 'delete_google_ads_link': ('name', ), 'delete_ios_app_data_stream': ('name', ), @@ -70,7 +76,10 @@ class adminCallTransformer(cst.CSTTransformer): 'get_conversion_event': ('name', ), 'get_custom_dimension': ('name', ), 'get_custom_metric': ('name', ), + 'get_data_retention_settings': ('name', ), 'get_data_sharing_settings': ('name', ), + 'get_display_video360_advertiser_link': ('name', ), + 'get_display_video360_advertiser_link_proposal': ('name', ), 'get_enhanced_measurement_settings': ('name', ), 'get_global_site_tag': ('name', ), 'get_google_signals_settings': ('name', ), @@ -85,6 +94,8 @@ class adminCallTransformer(cst.CSTTransformer): 'list_conversion_events': ('parent', 'page_size', 'page_token', ), 'list_custom_dimensions': ('parent', 'page_size', 'page_token', ), 'list_custom_metrics': ('parent', 'page_size', 'page_token', ), + 'list_display_video360_advertiser_link_proposals': ('parent', 'page_size', 'page_token', ), + 'list_display_video360_advertiser_links': ('parent', 'page_size', 'page_token', ), 'list_firebase_links': ('parent', 'page_size', 'page_token', ), 'list_google_ads_links': ('parent', 'page_size', 'page_token', ), 'list_ios_app_data_streams': ('parent', 'page_size', 'page_token', ), @@ -98,8 +109,9 @@ class adminCallTransformer(cst.CSTTransformer): 'update_android_app_data_stream': ('android_app_data_stream', 'update_mask', ), 'update_custom_dimension': ('update_mask', 'custom_dimension', ), 'update_custom_metric': ('update_mask', 'custom_metric', ), + 'update_data_retention_settings': ('data_retention_settings', 'update_mask', ), + 'update_display_video360_advertiser_link': ('update_mask', 'display_video_360_advertiser_link', ), 'update_enhanced_measurement_settings': ('enhanced_measurement_settings', 'update_mask', ), - 'update_firebase_link': ('firebase_link', 'update_mask', ), 'update_google_ads_link': ('update_mask', 'google_ads_link', ), 'update_google_signals_settings': ('google_signals_settings', 'update_mask', ), 'update_ios_app_data_stream': ('ios_app_data_stream', 'update_mask', ), diff --git a/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py b/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py index a93b74371dd4..18c19fadccfd 100644 --- a/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py +++ b/packages/google-analytics-admin/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py @@ -1785,6 +1785,7 @@ def test_get_property( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) response = client.get_property(request) @@ -1801,6 +1802,7 @@ def test_get_property( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD def test_get_property_from_dict(): @@ -1845,6 +1847,7 @@ async def test_get_property_async( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) ) response = await client.get_property(request) @@ -1862,6 +1865,7 @@ async def test_get_property_async( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD @pytest.mark.asyncio @@ -2249,6 +2253,7 @@ def test_create_property( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) response = client.create_property(request) @@ -2265,6 +2270,7 @@ def test_create_property( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD def test_create_property_from_dict(): @@ -2309,6 +2315,7 @@ async def test_create_property_async( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) ) response = await client.create_property(request) @@ -2326,6 +2333,7 @@ async def test_create_property_async( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD @pytest.mark.asyncio @@ -2428,6 +2436,7 @@ def test_delete_property( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) response = client.delete_property(request) @@ -2444,6 +2453,7 @@ def test_delete_property( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD def test_delete_property_from_dict(): @@ -2488,6 +2498,7 @@ async def test_delete_property_async( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) ) response = await client.delete_property(request) @@ -2505,6 +2516,7 @@ async def test_delete_property_async( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD @pytest.mark.asyncio @@ -2656,6 +2668,7 @@ def test_update_property( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) response = client.update_property(request) @@ -2672,6 +2685,7 @@ def test_update_property( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD def test_update_property_from_dict(): @@ -2716,6 +2730,7 @@ async def test_update_property_async( industry_category=resources.IndustryCategory.AUTOMOTIVE, time_zone="time_zone_value", currency_code="currency_code_value", + service_level=resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD, ) ) response = await client.update_property(request) @@ -2733,6 +2748,7 @@ async def test_update_property_async( assert response.industry_category == resources.IndustryCategory.AUTOMOTIVE assert response.time_zone == "time_zone_value" assert response.currency_code == "currency_code_value" + assert response.service_level == resources.ServiceLevel.GOOGLE_ANALYTICS_STANDARD @pytest.mark.asyncio @@ -9200,9 +9216,7 @@ def test_create_firebase_link( ) as call: # Designate an appropriate return value for the call. call.return_value = resources.FirebaseLink( - name="name_value", - project="project_value", - maximum_user_access=resources.MaximumUserAccess.NO_ACCESS, + name="name_value", project="project_value", ) response = client.create_firebase_link(request) @@ -9215,7 +9229,6 @@ def test_create_firebase_link( assert isinstance(response, resources.FirebaseLink) assert response.name == "name_value" assert response.project == "project_value" - assert response.maximum_user_access == resources.MaximumUserAccess.NO_ACCESS def test_create_firebase_link_from_dict(): @@ -9258,11 +9271,7 @@ async def test_create_firebase_link_async( ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink( - name="name_value", - project="project_value", - maximum_user_access=resources.MaximumUserAccess.NO_ACCESS, - ) + resources.FirebaseLink(name="name_value", project="project_value",) ) response = await client.create_firebase_link(request) @@ -9275,7 +9284,6 @@ async def test_create_firebase_link_async( assert isinstance(response, resources.FirebaseLink) assert response.name == "name_value" assert response.project == "project_value" - assert response.maximum_user_access == resources.MaximumUserAccess.NO_ACCESS @pytest.mark.asyncio @@ -9430,259 +9438,6 @@ async def test_create_firebase_link_flattened_error_async(): ) -def test_update_firebase_link( - transport: str = "grpc", request_type=analytics_admin.UpdateFirebaseLinkRequest -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink( - name="name_value", - project="project_value", - maximum_user_access=resources.MaximumUserAccess.NO_ACCESS, - ) - response = client.update_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateFirebaseLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.FirebaseLink) - assert response.name == "name_value" - assert response.project == "project_value" - assert response.maximum_user_access == resources.MaximumUserAccess.NO_ACCESS - - -def test_update_firebase_link_from_dict(): - test_update_firebase_link(request_type=dict) - - -def test_update_firebase_link_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - client.update_firebase_link() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateFirebaseLinkRequest() - - -@pytest.mark.asyncio -async def test_update_firebase_link_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateFirebaseLinkRequest, -): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink( - name="name_value", - project="project_value", - maximum_user_access=resources.MaximumUserAccess.NO_ACCESS, - ) - ) - response = await client.update_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateFirebaseLinkRequest() - - # Establish that the response is the type that we expect. - assert isinstance(response, resources.FirebaseLink) - assert response.name == "name_value" - assert response.project == "project_value" - assert response.maximum_user_access == resources.MaximumUserAccess.NO_ACCESS - - -@pytest.mark.asyncio -async def test_update_firebase_link_async_from_dict(): - await test_update_firebase_link_async(request_type=dict) - - -def test_update_firebase_link_field_headers(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateFirebaseLinkRequest() - - request.firebase_link.name = "firebase_link.name/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - call.return_value = resources.FirebaseLink() - client.update_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "firebase_link.name=firebase_link.name/value", - ) in kw["metadata"] - - -@pytest.mark.asyncio -async def test_update_firebase_link_field_headers_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Any value that is part of the HTTP/1.1 URI should be sent as - # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateFirebaseLinkRequest() - - request.firebase_link.name = "firebase_link.name/value" - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink() - ) - await client.update_firebase_link(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0] == request - - # Establish that the field header was sent. - _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "firebase_link.name=firebase_link.name/value", - ) in kw["metadata"] - - -def test_update_firebase_link_flattened(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink() - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - client.update_firebase_link( - firebase_link=resources.FirebaseLink(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0].firebase_link == resources.FirebaseLink(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) - - -def test_update_firebase_link_flattened_error(): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - client.update_firebase_link( - analytics_admin.UpdateFirebaseLinkRequest(), - firebase_link=resources.FirebaseLink(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - -@pytest.mark.asyncio -async def test_update_firebase_link_flattened_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.update_firebase_link), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = resources.FirebaseLink() - - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.FirebaseLink() - ) - # Call the method with a truthy value for each flattened field, - # using the keyword arguments to the method. - response = await client.update_firebase_link( - firebase_link=resources.FirebaseLink(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - # Establish that the underlying call was made with the expected - # request object values. - assert len(call.mock_calls) - _, args, _ = call.mock_calls[0] - assert args[0].firebase_link == resources.FirebaseLink(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) - - -@pytest.mark.asyncio -async def test_update_firebase_link_flattened_error_async(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), - ) - - # Attempting to call a method with both a request object and flattened - # fields is an error. - with pytest.raises(ValueError): - await client.update_firebase_link( - analytics_admin.UpdateFirebaseLinkRequest(), - firebase_link=resources.FirebaseLink(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) - - def test_delete_firebase_link( transport: str = "grpc", request_type=analytics_admin.DeleteFirebaseLinkRequest ): @@ -10534,7 +10289,7 @@ def test_create_google_ads_link( name="name_value", customer_id="customer_id_value", can_manage_clients=True, - email_address="email_address_value", + creator_email_address="creator_email_address_value", ) response = client.create_google_ads_link(request) @@ -10548,7 +10303,7 @@ def test_create_google_ads_link( assert response.name == "name_value" assert response.customer_id == "customer_id_value" assert response.can_manage_clients is True - assert response.email_address == "email_address_value" + assert response.creator_email_address == "creator_email_address_value" def test_create_google_ads_link_from_dict(): @@ -10595,7 +10350,7 @@ async def test_create_google_ads_link_async( name="name_value", customer_id="customer_id_value", can_manage_clients=True, - email_address="email_address_value", + creator_email_address="creator_email_address_value", ) ) response = await client.create_google_ads_link(request) @@ -10610,7 +10365,7 @@ async def test_create_google_ads_link_async( assert response.name == "name_value" assert response.customer_id == "customer_id_value" assert response.can_manage_clients is True - assert response.email_address == "email_address_value" + assert response.creator_email_address == "creator_email_address_value" @pytest.mark.asyncio @@ -10785,7 +10540,7 @@ def test_update_google_ads_link( name="name_value", customer_id="customer_id_value", can_manage_clients=True, - email_address="email_address_value", + creator_email_address="creator_email_address_value", ) response = client.update_google_ads_link(request) @@ -10799,7 +10554,7 @@ def test_update_google_ads_link( assert response.name == "name_value" assert response.customer_id == "customer_id_value" assert response.can_manage_clients is True - assert response.email_address == "email_address_value" + assert response.creator_email_address == "creator_email_address_value" def test_update_google_ads_link_from_dict(): @@ -10846,7 +10601,7 @@ async def test_update_google_ads_link_async( name="name_value", customer_id="customer_id_value", can_manage_clients=True, - email_address="email_address_value", + creator_email_address="creator_email_address_value", ) ) response = await client.update_google_ads_link(request) @@ -10861,7 +10616,7 @@ async def test_update_google_ads_link_async( assert response.name == "name_value" assert response.customer_id == "customer_id_value" assert response.can_manage_clients is True - assert response.email_address == "email_address_value" + assert response.creator_email_address == "creator_email_address_value" @pytest.mark.asyncio @@ -14140,7 +13895,10 @@ def test_create_conversion_event( ) as call: # Designate an appropriate return value for the call. call.return_value = resources.ConversionEvent( - name="name_value", event_name="event_name_value", is_deletable=True, + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, ) response = client.create_conversion_event(request) @@ -14153,7 +13911,8 @@ def test_create_conversion_event( assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" assert response.event_name == "event_name_value" - assert response.is_deletable is True + assert response.deletable is True + assert response.custom is True def test_create_conversion_event_from_dict(): @@ -14197,7 +13956,10 @@ async def test_create_conversion_event_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.ConversionEvent( - name="name_value", event_name="event_name_value", is_deletable=True, + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, ) ) response = await client.create_conversion_event(request) @@ -14211,7 +13973,8 @@ async def test_create_conversion_event_async( assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" assert response.event_name == "event_name_value" - assert response.is_deletable is True + assert response.deletable is True + assert response.custom is True @pytest.mark.asyncio @@ -14383,7 +14146,10 @@ def test_get_conversion_event( ) as call: # Designate an appropriate return value for the call. call.return_value = resources.ConversionEvent( - name="name_value", event_name="event_name_value", is_deletable=True, + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, ) response = client.get_conversion_event(request) @@ -14396,7 +14162,8 @@ def test_get_conversion_event( assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" assert response.event_name == "event_name_value" - assert response.is_deletable is True + assert response.deletable is True + assert response.custom is True def test_get_conversion_event_from_dict(): @@ -14440,7 +14207,10 @@ async def test_get_conversion_event_async( # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( resources.ConversionEvent( - name="name_value", event_name="event_name_value", is_deletable=True, + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, ) ) response = await client.get_conversion_event(request) @@ -14454,7 +14224,8 @@ async def test_get_conversion_event_async( assert isinstance(response, resources.ConversionEvent) assert response.name == "name_value" assert response.event_name == "event_name_value" - assert response.is_deletable is True + assert response.deletable is True + assert response.custom is True @pytest.mark.asyncio @@ -15213,8 +14984,9 @@ async def test_list_conversion_events_async_pages(): assert page_.raw_page.next_page_token == token -def test_create_custom_dimension( - transport: str = "grpc", request_type=analytics_admin.CreateCustomDimensionRequest +def test_get_display_video360_advertiser_link( + transport: str = "grpc", + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15226,39 +14998,33 @@ def test_create_custom_dimension( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( + call.return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.create_custom_dimension(request) + response = client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_create_custom_dimension_from_dict(): - test_create_custom_dimension(request_type=dict) +def test_get_display_video360_advertiser_link_from_dict(): + test_get_display_video360_advertiser_link(request_type=dict) -def test_create_custom_dimension_empty_call(): +def test_get_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -15267,18 +15033,18 @@ def test_create_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - client.create_custom_dimension() + client.get_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_create_custom_dimension_async( +async def test_get_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomDimensionRequest, + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15290,58 +15056,52 @@ async def test_create_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( + resources.DisplayVideo360AdvertiserLink( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.create_custom_dimension(request) + response = await client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomDimensionRequest() + assert args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_create_custom_dimension_async_from_dict(): - await test_create_custom_dimension_async(request_type=dict) +async def test_get_display_video360_advertiser_link_async_from_dict(): + await test_get_display_video360_advertiser_link_async(request_type=dict) -def test_create_custom_dimension_field_headers(): +def test_get_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomDimensionRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.create_custom_dimension(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15350,29 +15110,29 @@ def test_create_custom_dimension_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] @pytest.mark.asyncio -async def test_create_custom_dimension_field_headers_async(): +async def test_get_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomDimensionRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DisplayVideo360AdvertiserLink() ) - await client.create_custom_dimension(request) + await client.get_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15381,36 +15141,32 @@ async def test_create_custom_dimension_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_custom_dimension_flattened(): +def test_get_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DisplayVideo360AdvertiserLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_custom_dimension( - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), - ) + client.get_display_video360_advertiser_link(name="name_value",) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + assert args[0].name == "name_value" -def test_create_custom_dimension_flattened_error(): +def test_get_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15418,46 +15174,41 @@ def test_create_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_dimension( - analytics_admin.CreateCustomDimensionRequest(), - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), + client.get_display_video360_advertiser_link( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_custom_dimension_flattened_async(): +async def test_get_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_dimension), "__call__" + type(client.transport.get_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DisplayVideo360AdvertiserLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DisplayVideo360AdvertiserLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_custom_dimension( - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), - ) + response = await client.get_display_video360_advertiser_link(name="name_value",) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + assert args[0].name == "name_value" @pytest.mark.asyncio -async def test_create_custom_dimension_flattened_error_async(): +async def test_get_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15465,15 +15216,15 @@ async def test_create_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_custom_dimension( - analytics_admin.CreateCustomDimensionRequest(), - parent="parent_value", - custom_dimension=resources.CustomDimension(name="name_value"), + await client.get_display_video360_advertiser_link( + analytics_admin.GetDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) -def test_update_custom_dimension( - transport: str = "grpc", request_type=analytics_admin.UpdateCustomDimensionRequest +def test_list_display_video360_advertiser_links( + transport: str = "grpc", + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15485,39 +15236,29 @@ def test_update_custom_dimension( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + next_page_token="next_page_token_value", ) - response = client.update_custom_dimension(request) + response = client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksPager) + assert response.next_page_token == "next_page_token_value" -def test_update_custom_dimension_from_dict(): - test_update_custom_dimension(request_type=dict) +def test_list_display_video360_advertiser_links_from_dict(): + test_list_display_video360_advertiser_links(request_type=dict) -def test_update_custom_dimension_empty_call(): +def test_list_display_video360_advertiser_links_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -15526,18 +15267,18 @@ def test_update_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - client.update_custom_dimension() + client.list_display_video360_advertiser_links() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() @pytest.mark.asyncio -async def test_update_custom_dimension_async( +async def test_list_display_video360_advertiser_links_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomDimensionRequest, + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinksRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -15549,58 +15290,48 @@ async def test_update_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_custom_dimension(request) + response = await client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + assert args[0] == analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinksAsyncPager) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_custom_dimension_async_from_dict(): - await test_update_custom_dimension_async(request_type=dict) +async def test_list_display_video360_advertiser_links_async_from_dict(): + await test_list_display_video360_advertiser_links_async(request_type=dict) -def test_update_custom_dimension_field_headers(): +def test_list_display_video360_advertiser_links_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomDimensionRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - request.custom_dimension.name = "custom_dimension.name/value" + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.update_custom_dimension(request) + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() + client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15609,32 +15340,29 @@ def test_update_custom_dimension_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "custom_dimension.name=custom_dimension.name/value", - ) in kw["metadata"] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] @pytest.mark.asyncio -async def test_update_custom_dimension_field_headers_async(): +async def test_list_display_video360_advertiser_links_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomDimensionRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinksRequest() - request.custom_dimension.name = "custom_dimension.name/value" + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() ) - await client.update_custom_dimension(request) + await client.list_display_video360_advertiser_links(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15643,39 +15371,32 @@ async def test_update_custom_dimension_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "custom_dimension.name=custom_dimension.name/value", - ) in kw["metadata"] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_update_custom_dimension_flattened(): +def test_list_display_video360_advertiser_links_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_custom_dimension( - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + client.list_display_video360_advertiser_links(parent="parent_value",) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].custom_dimension == resources.CustomDimension(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + assert args[0].parent == "parent_value" -def test_update_custom_dimension_flattened_error(): +def test_list_display_video360_advertiser_links_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15683,46 +15404,43 @@ def test_update_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_dimension( - analytics_admin.UpdateCustomDimensionRequest(), - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_display_video360_advertiser_links( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_custom_dimension_flattened_async(): +async def test_list_display_video360_advertiser_links_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_dimension), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_custom_dimension( - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_display_video360_advertiser_links( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].custom_dimension == resources.CustomDimension(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + assert args[0].parent == "parent_value" @pytest.mark.asyncio -async def test_update_custom_dimension_flattened_error_async(): +async def test_list_display_video360_advertiser_links_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15730,122 +15448,322 @@ async def test_update_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_custom_dimension( - analytics_admin.UpdateCustomDimensionRequest(), - custom_dimension=resources.CustomDimension(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.list_display_video360_advertiser_links( + analytics_admin.ListDisplayVideo360AdvertiserLinksRequest(), + parent="parent_value", ) -def test_list_custom_dimensions( - transport: str = "grpc", request_type=analytics_admin.ListCustomDimensionsRequest -): +def test_list_display_video360_advertiser_links_pager(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse( - next_page_token="next_page_token_value", + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, ) - response = client.list_custom_dimensions(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() - # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomDimensionsPager) - assert response.next_page_token == "next_page_token_value" + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_display_video360_advertiser_links(request={}) + assert pager._metadata == metadata -def test_list_custom_dimensions_from_dict(): - test_list_custom_dimensions(request_type=dict) + results = [i for i in pager] + assert len(results) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in results + ) -def test_list_custom_dimensions_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. +def test_list_display_video360_advertiser_links_pages(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + credentials=ga_credentials.AnonymousCredentials, ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.list_display_video360_advertiser_links), "__call__" ) as call: - client.list_custom_dimensions() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, + ) + pages = list(client.list_display_video360_advertiser_links(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_custom_dimensions_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomDimensionsRequest, -): +async def test_list_display_video360_advertiser_links_async_pager(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.list_display_video360_advertiser_links), + "__call__", + new_callable=mock.AsyncMock, ) as call: - # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse( - next_page_token="next_page_token_value", - ) - ) - response = await client.list_custom_dimensions(request) - + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_display_video360_advertiser_links(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLink) for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_display_video360_advertiser_links_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_display_video360_advertiser_links), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinksResponse( + display_video_360_advertiser_links=[ + resources.DisplayVideo360AdvertiserLink(), + resources.DisplayVideo360AdvertiserLink(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_display_video360_advertiser_links(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_create_display_video360_advertiser_link( + transport: str = "grpc", + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_display_video360_advertiser_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DisplayVideo360AdvertiserLink( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + ) + response = client.create_display_video360_advertiser_link(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + + +def test_create_display_video360_advertiser_link_from_dict(): + test_create_display_video360_advertiser_link(request_type=dict) + + +def test_create_display_video360_advertiser_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_display_video360_advertiser_link), "__call__" + ) as call: + client.create_display_video360_advertiser_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() + + +@pytest.mark.asyncio +async def test_create_display_video360_advertiser_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_display_video360_advertiser_link), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLink( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + ) + ) + response = await client.create_display_video360_advertiser_link(request) + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomDimensionsRequest() + assert args[0] == analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomDimensionsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_list_custom_dimensions_async_from_dict(): - await test_list_custom_dimensions_async(request_type=dict) +async def test_create_display_video360_advertiser_link_async_from_dict(): + await test_create_display_video360_advertiser_link_async(request_type=dict) -def test_list_custom_dimensions_field_headers(): +def test_create_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomDimensionsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = analytics_admin.ListCustomDimensionsResponse() - client.list_custom_dimensions(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -15858,25 +15776,25 @@ def test_list_custom_dimensions_field_headers(): @pytest.mark.asyncio -async def test_list_custom_dimensions_field_headers_async(): +async def test_create_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomDimensionsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest() request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse() + resources.DisplayVideo360AdvertiserLink() ) - await client.list_custom_dimensions(request) + await client.create_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -15888,29 +15806,39 @@ async def test_list_custom_dimensions_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_custom_dimensions_flattened(): +def test_create_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse() + call.return_value = resources.DisplayVideo360AdvertiserLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_custom_dimensions(parent="parent_value",) + client.create_display_video360_advertiser_link( + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] assert args[0].parent == "parent_value" + assert args[ + 0 + ].display_video_360_advertiser_link == resources.DisplayVideo360AdvertiserLink( + name="name_value" + ) -def test_list_custom_dimensions_flattened_error(): +def test_create_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15918,40 +15846,54 @@ def test_list_custom_dimensions_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_dimensions( - analytics_admin.ListCustomDimensionsRequest(), parent="parent_value", + client.create_display_video360_advertiser_link( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_list_custom_dimensions_flattened_async(): +async def test_create_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.create_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomDimensionsResponse() + call.return_value = resources.DisplayVideo360AdvertiserLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomDimensionsResponse() + resources.DisplayVideo360AdvertiserLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_custom_dimensions(parent="parent_value",) + response = await client.create_display_video360_advertiser_link( + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] assert args[0].parent == "parent_value" + assert args[ + 0 + ].display_video_360_advertiser_link == resources.DisplayVideo360AdvertiserLink( + name="name_value" + ) @pytest.mark.asyncio -async def test_list_custom_dimensions_flattened_error_async(): +async def test_create_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -15959,239 +15901,70 @@ async def test_list_custom_dimensions_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_custom_dimensions( - analytics_admin.ListCustomDimensionsRequest(), parent="parent_value", + await client.create_display_video360_advertiser_link( + analytics_admin.CreateDisplayVideo360AdvertiserLinkRequest(), + parent="parent_value", + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), ) -def test_list_custom_dimensions_pager(): +def test_delete_display_video360_advertiser_link( + transport: str = "grpc", + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_display_video360_advertiser_link(request) - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), - ) - pager = client.list_custom_dimensions(request={}) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() - assert pager._metadata == metadata + # Establish that the response is the type that we expect. + assert response is None - results = [i for i in pager] - assert len(results) == 6 - assert all(isinstance(i, resources.CustomDimension) for i in results) +def test_delete_display_video360_advertiser_link_from_dict(): + test_delete_display_video360_advertiser_link(request_type=dict) -def test_list_custom_dimensions_pages(): + +def test_delete_display_video360_advertiser_link_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_dimensions), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - pages = list(client.list_custom_dimensions(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token + client.delete_display_video360_advertiser_link() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_list_custom_dimensions_async_pager(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - async_pager = await client.list_custom_dimensions(request={},) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: - responses.append(response) - - assert len(responses) == 6 - assert all(isinstance(i, resources.CustomDimension) for i in responses) - - -@pytest.mark.asyncio -async def test_list_custom_dimensions_async_pages(): - client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.list_custom_dimensions), - "__call__", - new_callable=mock.AsyncMock, - ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - resources.CustomDimension(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[], next_page_token="def", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", - ), - analytics_admin.ListCustomDimensionsResponse( - custom_dimensions=[ - resources.CustomDimension(), - resources.CustomDimension(), - ], - ), - RuntimeError, - ) - pages = [] - async for page_ in (await client.list_custom_dimensions(request={})).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token - - -def test_archive_custom_dimension( - transport: str = "grpc", request_type=analytics_admin.ArchiveCustomDimensionRequest -): - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, - ) - - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" - ) as call: - # Designate an appropriate return value for the call. - call.return_value = None - response = client.archive_custom_dimension(request) - - # Establish that the underlying gRPC stub method was called. - assert len(call.mock_calls) == 1 - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() - - # Establish that the response is the type that we expect. - assert response is None - - -def test_archive_custom_dimension_from_dict(): - test_archive_custom_dimension(request_type=dict) - - -def test_archive_custom_dimension_empty_call(): - # This test is a coverage failsafe to make sure that totally empty calls, - # i.e. request == None and no flattened fields passed, work. - client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport="grpc", - ) - - # Mock the actual call within the gRPC stub, and fake the request. - with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" - ) as call: - client.archive_custom_dimension() - call.assert_called() - _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() - - -@pytest.mark.asyncio -async def test_archive_custom_dimension_async( - transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomDimensionRequest, -): +async def test_delete_display_video360_advertiser_link_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest, +): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) @@ -16202,43 +15975,43 @@ async def test_archive_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.archive_custom_dimension(request) + response = await client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + assert args[0] == analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. assert response is None @pytest.mark.asyncio -async def test_archive_custom_dimension_async_from_dict(): - await test_archive_custom_dimension_async(request_type=dict) +async def test_delete_display_video360_advertiser_link_async_from_dict(): + await test_delete_display_video360_advertiser_link_async(request_type=dict) -def test_archive_custom_dimension_field_headers(): +def test_delete_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomDimensionRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: call.return_value = None - client.archive_custom_dimension(request) + client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16251,23 +16024,23 @@ def test_archive_custom_dimension_field_headers(): @pytest.mark.asyncio -async def test_archive_custom_dimension_field_headers_async(): +async def test_delete_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomDimensionRequest() + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest() request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.archive_custom_dimension(request) + await client.delete_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16279,20 +16052,20 @@ async def test_archive_custom_dimension_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_archive_custom_dimension_flattened(): +def test_delete_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = None # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.archive_custom_dimension(name="name_value",) + client.delete_display_video360_advertiser_link(name="name_value",) # Establish that the underlying call was made with the expected # request object values. @@ -16301,7 +16074,7 @@ def test_archive_custom_dimension_flattened(): assert args[0].name == "name_value" -def test_archive_custom_dimension_flattened_error(): +def test_delete_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16309,20 +16082,21 @@ def test_archive_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_dimension( - analytics_admin.ArchiveCustomDimensionRequest(), name="name_value", + client.delete_display_video360_advertiser_link( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_archive_custom_dimension_flattened_async(): +async def test_delete_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_dimension), "__call__" + type(client.transport.delete_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = None @@ -16330,7 +16104,9 @@ async def test_archive_custom_dimension_flattened_async(): call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.archive_custom_dimension(name="name_value",) + response = await client.delete_display_video360_advertiser_link( + name="name_value", + ) # Establish that the underlying call was made with the expected # request object values. @@ -16340,7 +16116,7 @@ async def test_archive_custom_dimension_flattened_async(): @pytest.mark.asyncio -async def test_archive_custom_dimension_flattened_error_async(): +async def test_delete_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16348,13 +16124,15 @@ async def test_archive_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.archive_custom_dimension( - analytics_admin.ArchiveCustomDimensionRequest(), name="name_value", + await client.delete_display_video360_advertiser_link( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkRequest(), + name="name_value", ) -def test_get_custom_dimension( - transport: str = "grpc", request_type=analytics_admin.GetCustomDimensionRequest +def test_update_display_video360_advertiser_link( + transport: str = "grpc", + request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16366,39 +16144,33 @@ def test_get_custom_dimension( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension( + call.return_value = resources.DisplayVideo360AdvertiserLink( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) - response = client.get_custom_dimension(request) + response = client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" -def test_get_custom_dimension_from_dict(): - test_get_custom_dimension(request_type=dict) +def test_update_display_video360_advertiser_link_from_dict(): + test_update_display_video360_advertiser_link(request_type=dict) -def test_get_custom_dimension_empty_call(): +def test_update_display_video360_advertiser_link_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16407,18 +16179,18 @@ def test_get_custom_dimension_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: - client.get_custom_dimension() + client.update_display_video360_advertiser_link() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() @pytest.mark.asyncio -async def test_get_custom_dimension_async( +async def test_update_display_video360_advertiser_link_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.GetCustomDimensionRequest, + request_type=analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16430,58 +16202,54 @@ async def test_get_custom_dimension_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension( + resources.DisplayVideo360AdvertiserLink( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - scope=resources.CustomDimension.DimensionScope.EVENT, - disallow_ads_personalization=True, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", ) ) - response = await client.get_custom_dimension(request) + response = await client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomDimensionRequest() + assert args[0] == analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomDimension) + assert isinstance(response, resources.DisplayVideo360AdvertiserLink) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.scope == resources.CustomDimension.DimensionScope.EVENT - assert response.disallow_ads_personalization is True + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" @pytest.mark.asyncio -async def test_get_custom_dimension_async_from_dict(): - await test_get_custom_dimension_async(request_type=dict) +async def test_update_display_video360_advertiser_link_async_from_dict(): + await test_update_display_video360_advertiser_link_async(request_type=dict) -def test_get_custom_dimension_field_headers(): +def test_update_display_video360_advertiser_link_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomDimensionRequest() + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - request.name = "name/value" + request.display_video_360_advertiser_link.name = ( + "display_video_360_advertiser_link.name/value" + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: - call.return_value = resources.CustomDimension() - client.get_custom_dimension(request) + call.return_value = resources.DisplayVideo360AdvertiserLink() + client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16490,29 +16258,34 @@ def test_get_custom_dimension_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "display_video_360_advertiser_link.name=display_video_360_advertiser_link.name/value", + ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_custom_dimension_field_headers_async(): +async def test_update_display_video360_advertiser_link_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomDimensionRequest() + request = analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest() - request.name = "name/value" + request.display_video_360_advertiser_link.name = ( + "display_video_360_advertiser_link.name/value" + ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DisplayVideo360AdvertiserLink() ) - await client.get_custom_dimension(request) + await client.update_display_video360_advertiser_link(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16521,32 +16294,45 @@ async def test_get_custom_dimension_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "display_video_360_advertiser_link.name=display_video_360_advertiser_link.name/value", + ) in kw["metadata"] -def test_get_custom_dimension_flattened(): +def test_update_display_video360_advertiser_link_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DisplayVideo360AdvertiserLink() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_custom_dimension(name="name_value",) + client.update_display_video360_advertiser_link( + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + assert args[ + 0 + ].display_video_360_advertiser_link == resources.DisplayVideo360AdvertiserLink( + name="name_value" + ) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) -def test_get_custom_dimension_flattened_error(): +def test_update_display_video360_advertiser_link_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16554,40 +16340,54 @@ def test_get_custom_dimension_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_dimension( - analytics_admin.GetCustomDimensionRequest(), name="name_value", + client.update_display_video360_advertiser_link( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_custom_dimension_flattened_async(): +async def test_update_display_video360_advertiser_link_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_dimension), "__call__" + type(client.transport.update_display_video360_advertiser_link), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomDimension() + call.return_value = resources.DisplayVideo360AdvertiserLink() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomDimension() + resources.DisplayVideo360AdvertiserLink() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_custom_dimension(name="name_value",) + response = await client.update_display_video360_advertiser_link( + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + assert args[ + 0 + ].display_video_360_advertiser_link == resources.DisplayVideo360AdvertiserLink( + name="name_value" + ) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio -async def test_get_custom_dimension_flattened_error_async(): +async def test_update_display_video360_advertiser_link_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16595,13 +16395,18 @@ async def test_get_custom_dimension_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_custom_dimension( - analytics_admin.GetCustomDimensionRequest(), name="name_value", + await client.update_display_video360_advertiser_link( + analytics_admin.UpdateDisplayVideo360AdvertiserLinkRequest(), + display_video_360_advertiser_link=resources.DisplayVideo360AdvertiserLink( + name="name_value" + ), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) -def test_create_custom_metric( - transport: str = "grpc", request_type=analytics_admin.CreateCustomMetricRequest +def test_get_display_video360_advertiser_link_proposal( + transport: str = "grpc", + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16613,39 +16418,37 @@ def test_create_custom_metric( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) - response = client.create_custom_metric(request) + response = client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_create_custom_metric_from_dict(): - test_create_custom_metric(request_type=dict) +def test_get_display_video360_advertiser_link_proposal_from_dict(): + test_get_display_video360_advertiser_link_proposal(request_type=dict) -def test_create_custom_metric_empty_call(): +def test_get_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16654,18 +16457,20 @@ def test_create_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: - client.create_custom_metric() + client.get_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_create_custom_metric_async( +async def test_get_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.CreateCustomMetricRequest, + request_type=analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16677,58 +16482,56 @@ async def test_create_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( + resources.DisplayVideo360AdvertiserLinkProposal( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) ) - response = await client.create_custom_metric(request) + response = await client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.CreateCustomMetricRequest() + assert ( + args[0] == analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" @pytest.mark.asyncio -async def test_create_custom_metric_async_from_dict(): - await test_create_custom_metric_async(request_type=dict) +async def test_get_display_video360_advertiser_link_proposal_async_from_dict(): + await test_get_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_create_custom_metric_field_headers(): +def test_get_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomMetricRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: - call.return_value = resources.CustomMetric() - client.create_custom_metric(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16737,29 +16540,29 @@ def test_create_custom_metric_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] @pytest.mark.asyncio -async def test_create_custom_metric_field_headers_async(): +async def test_get_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.CreateCustomMetricRequest() + request = analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest() - request.parent = "parent/value" + request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DisplayVideo360AdvertiserLinkProposal() ) - await client.create_custom_metric(request) + await client.get_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -16768,36 +16571,32 @@ async def test_create_custom_metric_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_create_custom_metric_flattened(): +def test_get_display_video360_advertiser_link_proposal_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.create_custom_metric( - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), - ) + client.get_display_video360_advertiser_link_proposal(name="name_value",) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].custom_metric == resources.CustomMetric(name="name_value") + assert args[0].name == "name_value" -def test_create_custom_metric_flattened_error(): +def test_get_display_video360_advertiser_link_proposal_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16805,46 +16604,43 @@ def test_create_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.create_custom_metric( - analytics_admin.CreateCustomMetricRequest(), - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + client.get_display_video360_advertiser_link_proposal( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", ) @pytest.mark.asyncio -async def test_create_custom_metric_flattened_async(): +async def test_get_display_video360_advertiser_link_proposal_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.create_custom_metric), "__call__" + type(client.transport.get_display_video360_advertiser_link_proposal), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DisplayVideo360AdvertiserLinkProposal() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.create_custom_metric( - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + response = await client.get_display_video360_advertiser_link_proposal( + name="name_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].parent == "parent_value" - assert args[0].custom_metric == resources.CustomMetric(name="name_value") + assert args[0].name == "name_value" @pytest.mark.asyncio -async def test_create_custom_metric_flattened_error_async(): +async def test_get_display_video360_advertiser_link_proposal_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -16852,15 +16648,15 @@ async def test_create_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.create_custom_metric( - analytics_admin.CreateCustomMetricRequest(), - parent="parent_value", - custom_metric=resources.CustomMetric(name="name_value"), + await client.get_display_video360_advertiser_link_proposal( + analytics_admin.GetDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", ) -def test_update_custom_metric( - transport: str = "grpc", request_type=analytics_admin.UpdateCustomMetricRequest +def test_list_display_video360_advertiser_link_proposals( + transport: str = "grpc", + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16872,39 +16668,33 @@ def test_update_custom_metric( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + call.return_value = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + next_page_token="next_page_token_value", ) - response = client.update_custom_metric(request) + response = client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert isinstance(response, pagers.ListDisplayVideo360AdvertiserLinkProposalsPager) + assert response.next_page_token == "next_page_token_value" -def test_update_custom_metric_from_dict(): - test_update_custom_metric(request_type=dict) +def test_list_display_video360_advertiser_link_proposals_from_dict(): + test_list_display_video360_advertiser_link_proposals(request_type=dict) -def test_update_custom_metric_empty_call(): +def test_list_display_video360_advertiser_link_proposals_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -16913,18 +16703,22 @@ def test_update_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: - client.update_custom_metric() + client.list_display_video360_advertiser_link_proposals() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) @pytest.mark.asyncio -async def test_update_custom_metric_async( +async def test_list_display_video360_advertiser_link_proposals_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.UpdateCustomMetricRequest, + request_type=analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -16936,58 +16730,57 @@ async def test_update_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( - name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + next_page_token="next_page_token_value", ) ) - response = await client.update_custom_metric(request) + response = await client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.UpdateCustomMetricRequest() + assert ( + args[0] + == analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) - assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert isinstance( + response, pagers.ListDisplayVideo360AdvertiserLinkProposalsAsyncPager + ) + assert response.next_page_token == "next_page_token_value" @pytest.mark.asyncio -async def test_update_custom_metric_async_from_dict(): - await test_update_custom_metric_async(request_type=dict) +async def test_list_display_video360_advertiser_link_proposals_async_from_dict(): + await test_list_display_video360_advertiser_link_proposals_async(request_type=dict) -def test_update_custom_metric_field_headers(): +def test_list_display_video360_advertiser_link_proposals_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomMetricRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() - request.custom_metric.name = "custom_metric.name/value" + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: - call.return_value = resources.CustomMetric() - client.update_custom_metric(request) + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) + client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -16996,32 +16789,30 @@ def test_update_custom_metric_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "custom_metric.name=custom_metric.name/value", - ) in kw["metadata"] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] @pytest.mark.asyncio -async def test_update_custom_metric_field_headers_async(): +async def test_list_display_video360_advertiser_link_proposals_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.UpdateCustomMetricRequest() + request = analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest() - request.custom_metric.name = "custom_metric.name/value" + request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() ) - await client.update_custom_metric(request) + await client.list_display_video360_advertiser_link_proposals(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17030,39 +16821,35 @@ async def test_update_custom_metric_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ( - "x-goog-request-params", - "custom_metric.name=custom_metric.name/value", - ) in kw["metadata"] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_update_custom_metric_flattened(): +def test_list_display_video360_advertiser_link_proposals_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.update_custom_metric( - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), - ) + client.list_display_video360_advertiser_link_proposals(parent="parent_value",) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].custom_metric == resources.CustomMetric(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + assert args[0].parent == "parent_value" -def test_update_custom_metric_flattened_error(): +def test_list_display_video360_advertiser_link_proposals_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17070,46 +16857,46 @@ def test_update_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.update_custom_metric( - analytics_admin.UpdateCustomMetricRequest(), - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + client.list_display_video360_advertiser_link_proposals( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), + parent="parent_value", ) @pytest.mark.asyncio -async def test_update_custom_metric_flattened_async(): +async def test_list_display_video360_advertiser_link_proposals_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.update_custom_metric), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() + ) call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.update_custom_metric( - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + response = await client.list_display_video360_advertiser_link_proposals( + parent="parent_value", ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].custom_metric == resources.CustomMetric(name="name_value") - assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + assert args[0].parent == "parent_value" @pytest.mark.asyncio -async def test_update_custom_metric_flattened_error_async(): +async def test_list_display_video360_advertiser_link_proposals_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17117,49 +16904,259 @@ async def test_update_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.update_custom_metric( - analytics_admin.UpdateCustomMetricRequest(), - custom_metric=resources.CustomMetric(name="name_value"), - update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + await client.list_display_video360_advertiser_link_proposals( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsRequest(), + parent="parent_value", ) -def test_list_custom_metrics( - transport: str = "grpc", request_type=analytics_admin.ListCustomMetricsRequest -): +def test_list_display_video360_advertiser_link_proposals_pager(): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials(), transport=transport, + credentials=ga_credentials.AnonymousCredentials, ) - # Everything is optional in proto3 as far as the runtime is concerned, - # and we are mocking out the actual API, so just send an empty request. - request = request_type() - # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", ) as call: - # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse( - next_page_token="next_page_token_value", - ) - response = client.list_custom_metrics(request) - + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_display_video360_advertiser_link_proposals(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) + for i in results + ) + + +def test_list_display_video360_advertiser_link_proposals_pages(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + ), + RuntimeError, + ) + pages = list( + client.list_display_video360_advertiser_link_proposals(request={}).pages + ) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_display_video360_advertiser_link_proposals_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_display_video360_advertiser_link_proposals( + request={}, + ) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all( + isinstance(i, resources.DisplayVideo360AdvertiserLinkProposal) + for i in responses + ) + + +@pytest.mark.asyncio +async def test_list_display_video360_advertiser_link_proposals_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_display_video360_advertiser_link_proposals), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="abc", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[], next_page_token="def", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + next_page_token="ghi", + ), + analytics_admin.ListDisplayVideo360AdvertiserLinkProposalsResponse( + display_video_360_advertiser_link_proposals=[ + resources.DisplayVideo360AdvertiserLinkProposal(), + resources.DisplayVideo360AdvertiserLinkProposal(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in ( + await client.list_display_video360_advertiser_link_proposals(request={}) + ).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_create_display_video360_advertiser_link_proposal( + transport: str = "grpc", + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", + ) + response = client.create_display_video360_advertiser_link_proposal(request) + # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomMetricsPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" -def test_list_custom_metrics_from_dict(): - test_list_custom_metrics(request_type=dict) +def test_create_display_video360_advertiser_link_proposal_from_dict(): + test_create_display_video360_advertiser_link_proposal(request_type=dict) -def test_list_custom_metrics_empty_call(): +def test_create_display_video360_advertiser_link_proposal_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17168,18 +17165,22 @@ def test_list_custom_metrics_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: - client.list_custom_metrics() + client.create_display_video360_advertiser_link_proposal() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) @pytest.mark.asyncio -async def test_list_custom_metrics_async( +async def test_create_display_video360_advertiser_link_proposal_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ListCustomMetricsRequest, + request_type=analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17191,48 +17192,61 @@ async def test_list_custom_metrics_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse( - next_page_token="next_page_token_value", + resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", ) ) - response = await client.list_custom_metrics(request) + response = await client.create_display_video360_advertiser_link_proposal( + request + ) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ListCustomMetricsRequest() + assert ( + args[0] + == analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() + ) # Establish that the response is the type that we expect. - assert isinstance(response, pagers.ListCustomMetricsAsyncPager) - assert response.next_page_token == "next_page_token_value" + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" @pytest.mark.asyncio -async def test_list_custom_metrics_async_from_dict(): - await test_list_custom_metrics_async(request_type=dict) +async def test_create_display_video360_advertiser_link_proposal_async_from_dict(): + await test_create_display_video360_advertiser_link_proposal_async(request_type=dict) -def test_list_custom_metrics_field_headers(): +def test_create_display_video360_advertiser_link_proposal_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomMetricsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: - call.return_value = analytics_admin.ListCustomMetricsResponse() - client.list_custom_metrics(request) + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.create_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17245,25 +17259,26 @@ def test_list_custom_metrics_field_headers(): @pytest.mark.asyncio -async def test_list_custom_metrics_field_headers_async(): +async def test_create_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ListCustomMetricsRequest() + request = analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest() request.parent = "parent/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse() + resources.DisplayVideo360AdvertiserLinkProposal() ) - await client.list_custom_metrics(request) + await client.create_display_video360_advertiser_link_proposal(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17275,29 +17290,40 @@ async def test_list_custom_metrics_field_headers_async(): assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] -def test_list_custom_metrics_flattened(): +def test_create_display_video360_advertiser_link_proposal_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.list_custom_metrics(parent="parent_value",) + client.create_display_video360_advertiser_link_proposal( + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] assert args[0].parent == "parent_value" + assert args[ + 0 + ].display_video_360_advertiser_link_proposal == resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ) -def test_list_custom_metrics_flattened_error(): +def test_create_display_video360_advertiser_link_proposal_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17305,40 +17331,55 @@ def test_list_custom_metrics_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.list_custom_metrics( - analytics_admin.ListCustomMetricsRequest(), parent="parent_value", + client.create_display_video360_advertiser_link_proposal( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) @pytest.mark.asyncio -async def test_list_custom_metrics_flattened_async(): +async def test_create_display_video360_advertiser_link_proposal_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.create_display_video360_advertiser_link_proposal), + "__call__", ) as call: # Designate an appropriate return value for the call. - call.return_value = analytics_admin.ListCustomMetricsResponse() + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - analytics_admin.ListCustomMetricsResponse() + resources.DisplayVideo360AdvertiserLinkProposal() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.list_custom_metrics(parent="parent_value",) + response = await client.create_display_video360_advertiser_link_proposal( + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] assert args[0].parent == "parent_value" + assert args[ + 0 + ].display_video_360_advertiser_link_proposal == resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ) @pytest.mark.asyncio -async def test_list_custom_metrics_flattened_error_async(): +async def test_create_display_video360_advertiser_link_proposal_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17346,175 +17387,3369 @@ async def test_list_custom_metrics_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.list_custom_metrics( - analytics_admin.ListCustomMetricsRequest(), parent="parent_value", + await client.create_display_video360_advertiser_link_proposal( + analytics_admin.CreateDisplayVideo360AdvertiserLinkProposalRequest(), + parent="parent_value", + display_video_360_advertiser_link_proposal=resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value" + ), ) -def test_list_custom_metrics_pager(): +def test_delete_display_video360_advertiser_link_proposal( + transport: str = "grpc", + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, +): client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], - ), - RuntimeError, - ) + # Designate an appropriate return value for the call. + call.return_value = None + response = client.delete_display_video360_advertiser_link_proposal(request) - metadata = () - metadata = tuple(metadata) + ( - gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() ) - pager = client.list_custom_metrics(request={}) - assert pager._metadata == metadata + # Establish that the response is the type that we expect. + assert response is None - results = [i for i in pager] - assert len(results) == 6 - assert all(isinstance(i, resources.CustomMetric) for i in results) +def test_delete_display_video360_advertiser_link_proposal_from_dict(): + test_delete_display_video360_advertiser_link_proposal(request_type=dict) -def test_list_custom_metrics_pages(): + +def test_delete_display_video360_advertiser_link_proposal_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), "__call__" + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], - ), - RuntimeError, + client.delete_display_video360_advertiser_link_proposal() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() ) - pages = list(client.list_custom_metrics(request={}).pages) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token @pytest.mark.asyncio -async def test_list_custom_metrics_async_pager(): +async def test_delete_display_video360_advertiser_link_proposal_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest, +): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), transport=transport, ) + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), + type(client.transport.delete_display_video360_advertiser_link_proposal), "__call__", - new_callable=mock.AsyncMock, ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], - ), - RuntimeError, + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.delete_display_video360_advertiser_link_proposal( + request ) - async_pager = await client.list_custom_metrics(request={},) - assert async_pager.next_page_token == "abc" - responses = [] - async for response in async_pager: - responses.append(response) - assert len(responses) == 6 - assert all(isinstance(i, resources.CustomMetric) for i in responses) + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + ) + + # Establish that the response is the type that we expect. + assert response is None @pytest.mark.asyncio -async def test_list_custom_metrics_async_pages(): +async def test_delete_display_video360_advertiser_link_proposal_async_from_dict(): + await test_delete_display_video360_advertiser_link_proposal_async(request_type=dict) + + +def test_delete_display_video360_advertiser_link_proposal_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = None + client.delete_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_delete_display_video360_advertiser_link_proposal_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( - credentials=ga_credentials.AnonymousCredentials, + credentials=ga_credentials.AnonymousCredentials(), ) + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.list_custom_metrics), + type(client.transport.delete_display_video360_advertiser_link_proposal), "__call__", - new_callable=mock.AsyncMock, ) as call: - # Set the response to a series of pages. - call.side_effect = ( - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[ - resources.CustomMetric(), - resources.CustomMetric(), - resources.CustomMetric(), - ], - next_page_token="abc", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[], next_page_token="def", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", - ), - analytics_admin.ListCustomMetricsResponse( - custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], - ), - RuntimeError, + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.delete_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_delete_display_video360_advertiser_link_proposal_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.delete_display_video360_advertiser_link_proposal(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +def test_delete_display_video360_advertiser_link_proposal_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.delete_display_video360_advertiser_link_proposal( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", + ) + + +@pytest.mark.asyncio +async def test_delete_display_video360_advertiser_link_proposal_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.delete_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.delete_display_video360_advertiser_link_proposal( + name="name_value", + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_delete_display_video360_advertiser_link_proposal_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.delete_display_video360_advertiser_link_proposal( + analytics_admin.DeleteDisplayVideo360AdvertiserLinkProposalRequest(), + name="name_value", + ) + + +def test_approve_display_video360_advertiser_link_proposal( + transport: str = "grpc", + request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) + response = client.approve_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + ) + + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ) + + +def test_approve_display_video360_advertiser_link_proposal_from_dict(): + test_approve_display_video360_advertiser_link_proposal(request_type=dict) + + +def test_approve_display_video360_advertiser_link_proposal_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + client.approve_display_video360_advertiser_link_proposal() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + ) + + +@pytest.mark.asyncio +async def test_approve_display_video360_advertiser_link_proposal_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) + response = await client.approve_display_video360_advertiser_link_proposal( + request + ) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + ) + + # Establish that the response is the type that we expect. + assert isinstance( + response, analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse + ) + + +@pytest.mark.asyncio +async def test_approve_display_video360_advertiser_link_proposal_async_from_dict(): + await test_approve_display_video360_advertiser_link_proposal_async( + request_type=dict + ) + + +def test_approve_display_video360_advertiser_link_proposal_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = ( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) + client.approve_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_approve_display_video360_advertiser_link_proposal_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.approve_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ApproveDisplayVideo360AdvertiserLinkProposalResponse() + ) + await client.approve_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_cancel_display_video360_advertiser_link_proposal( + transport: str = "grpc", + request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", + ) + response = client.cancel_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" + + +def test_cancel_display_video360_advertiser_link_proposal_from_dict(): + test_cancel_display_video360_advertiser_link_proposal(request_type=dict) + + +def test_cancel_display_video360_advertiser_link_proposal_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + client.cancel_display_video360_advertiser_link_proposal() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) + + +@pytest.mark.asyncio +async def test_cancel_display_video360_advertiser_link_proposal_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLinkProposal( + name="name_value", + advertiser_id="advertiser_id_value", + advertiser_display_name="advertiser_display_name_value", + validation_email="validation_email_value", + ) + ) + response = await client.cancel_display_video360_advertiser_link_proposal( + request + ) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert ( + args[0] + == analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + ) + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.DisplayVideo360AdvertiserLinkProposal) + assert response.name == "name_value" + assert response.advertiser_id == "advertiser_id_value" + assert response.advertiser_display_name == "advertiser_display_name_value" + assert response.validation_email == "validation_email_value" + + +@pytest.mark.asyncio +async def test_cancel_display_video360_advertiser_link_proposal_async_from_dict(): + await test_cancel_display_video360_advertiser_link_proposal_async(request_type=dict) + + +def test_cancel_display_video360_advertiser_link_proposal_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = resources.DisplayVideo360AdvertiserLinkProposal() + client.cancel_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_cancel_display_video360_advertiser_link_proposal_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CancelDisplayVideo360AdvertiserLinkProposalRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.cancel_display_video360_advertiser_link_proposal), + "__call__", + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DisplayVideo360AdvertiserLinkProposal() + ) + await client.cancel_display_video360_advertiser_link_proposal(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_create_custom_dimension( + transport: str = "grpc", request_type=analytics_admin.CreateCustomDimensionRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.create_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +def test_create_custom_dimension_from_dict(): + test_create_custom_dimension(request_type=dict) + + +def test_create_custom_dimension_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + client.create_custom_dimension() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomDimensionRequest() + + +@pytest.mark.asyncio +async def test_create_custom_dimension_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateCustomDimensionRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + ) + response = await client.create_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +@pytest.mark.asyncio +async def test_create_custom_dimension_async_from_dict(): + await test_create_custom_dimension_async(request_type=dict) + + +def test_create_custom_dimension_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateCustomDimensionRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + call.return_value = resources.CustomDimension() + client.create_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_custom_dimension_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateCustomDimensionRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + await client.create_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_custom_dimension_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_custom_dimension( + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + + +def test_create_custom_dimension_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_custom_dimension( + analytics_admin.CreateCustomDimensionRequest(), + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_custom_dimension_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_custom_dimension( + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + + +@pytest.mark.asyncio +async def test_create_custom_dimension_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_custom_dimension( + analytics_admin.CreateCustomDimensionRequest(), + parent="parent_value", + custom_dimension=resources.CustomDimension(name="name_value"), + ) + + +def test_update_custom_dimension( + transport: str = "grpc", request_type=analytics_admin.UpdateCustomDimensionRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.update_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +def test_update_custom_dimension_from_dict(): + test_update_custom_dimension(request_type=dict) + + +def test_update_custom_dimension_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + client.update_custom_dimension() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + + +@pytest.mark.asyncio +async def test_update_custom_dimension_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateCustomDimensionRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + ) + response = await client.update_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +@pytest.mark.asyncio +async def test_update_custom_dimension_async_from_dict(): + await test_update_custom_dimension_async(request_type=dict) + + +def test_update_custom_dimension_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.UpdateCustomDimensionRequest() + + request.custom_dimension.name = "custom_dimension.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + call.return_value = resources.CustomDimension() + client.update_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "custom_dimension.name=custom_dimension.name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_custom_dimension_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.UpdateCustomDimensionRequest() + + request.custom_dimension.name = "custom_dimension.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + await client.update_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "custom_dimension.name=custom_dimension.name/value", + ) in kw["metadata"] + + +def test_update_custom_dimension_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_custom_dimension( + custom_dimension=resources.CustomDimension(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + + +def test_update_custom_dimension_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_custom_dimension( + analytics_admin.UpdateCustomDimensionRequest(), + custom_dimension=resources.CustomDimension(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_custom_dimension_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_custom_dimension( + custom_dimension=resources.CustomDimension(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].custom_dimension == resources.CustomDimension(name="name_value") + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + + +@pytest.mark.asyncio +async def test_update_custom_dimension_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_custom_dimension( + analytics_admin.UpdateCustomDimensionRequest(), + custom_dimension=resources.CustomDimension(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_list_custom_dimensions( + transport: str = "grpc", request_type=analytics_admin.ListCustomDimensionsRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomDimensionsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_custom_dimensions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomDimensionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomDimensionsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_custom_dimensions_from_dict(): + test_list_custom_dimensions(request_type=dict) + + +def test_list_custom_dimensions_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + client.list_custom_dimensions() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomDimensionsRequest() + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListCustomDimensionsRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomDimensionsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_custom_dimensions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomDimensionsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomDimensionsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_async_from_dict(): + await test_list_custom_dimensions_async(request_type=dict) + + +def test_list_custom_dimensions_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListCustomDimensionsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + call.return_value = analytics_admin.ListCustomDimensionsResponse() + client.list_custom_dimensions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListCustomDimensionsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomDimensionsResponse() + ) + await client.list_custom_dimensions(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_custom_dimensions_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomDimensionsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_custom_dimensions(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + + +def test_list_custom_dimensions_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_custom_dimensions( + analytics_admin.ListCustomDimensionsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomDimensionsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomDimensionsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_custom_dimensions(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_custom_dimensions( + analytics_admin.ListCustomDimensionsRequest(), parent="parent_value", + ) + + +def test_list_custom_dimensions_pager(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_custom_dimensions(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, resources.CustomDimension) for i in results) + + +def test_list_custom_dimensions_pages(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, + ) + pages = list(client.list_custom_dimensions(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, + ) + async_pager = await client.list_custom_dimensions(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CustomDimension) for i in responses) + + +@pytest.mark.asyncio +async def test_list_custom_dimensions_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_dimensions), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + resources.CustomDimension(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[], next_page_token="def", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[resources.CustomDimension(),], next_page_token="ghi", + ), + analytics_admin.ListCustomDimensionsResponse( + custom_dimensions=[ + resources.CustomDimension(), + resources.CustomDimension(), + ], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_custom_dimensions(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_archive_custom_dimension( + transport: str = "grpc", request_type=analytics_admin.ArchiveCustomDimensionRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.archive_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_archive_custom_dimension_from_dict(): + test_archive_custom_dimension(request_type=dict) + + +def test_archive_custom_dimension_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + client.archive_custom_dimension() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + + +@pytest.mark.asyncio +async def test_archive_custom_dimension_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ArchiveCustomDimensionRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.archive_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_archive_custom_dimension_async_from_dict(): + await test_archive_custom_dimension_async(request_type=dict) + + +def test_archive_custom_dimension_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ArchiveCustomDimensionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + call.return_value = None + client.archive_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_archive_custom_dimension_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ArchiveCustomDimensionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.archive_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_archive_custom_dimension_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.archive_custom_dimension(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +def test_archive_custom_dimension_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.archive_custom_dimension( + analytics_admin.ArchiveCustomDimensionRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_archive_custom_dimension_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.archive_custom_dimension(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_archive_custom_dimension_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.archive_custom_dimension( + analytics_admin.ArchiveCustomDimensionRequest(), name="name_value", + ) + + +def test_get_custom_dimension( + transport: str = "grpc", request_type=analytics_admin.GetCustomDimensionRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + response = client.get_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +def test_get_custom_dimension_from_dict(): + test_get_custom_dimension(request_type=dict) + + +def test_get_custom_dimension_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + client.get_custom_dimension() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomDimensionRequest() + + +@pytest.mark.asyncio +async def test_get_custom_dimension_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.GetCustomDimensionRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + scope=resources.CustomDimension.DimensionScope.EVENT, + disallow_ads_personalization=True, + ) + ) + response = await client.get_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomDimensionRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomDimension) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.scope == resources.CustomDimension.DimensionScope.EVENT + assert response.disallow_ads_personalization is True + + +@pytest.mark.asyncio +async def test_get_custom_dimension_async_from_dict(): + await test_get_custom_dimension_async(request_type=dict) + + +def test_get_custom_dimension_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetCustomDimensionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + call.return_value = resources.CustomDimension() + client.get_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_custom_dimension_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetCustomDimensionRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + await client.get_custom_dimension(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_custom_dimension_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_custom_dimension(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +def test_get_custom_dimension_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_custom_dimension( + analytics_admin.GetCustomDimensionRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_custom_dimension_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_dimension), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomDimension() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomDimension() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_custom_dimension(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_custom_dimension_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_custom_dimension( + analytics_admin.GetCustomDimensionRequest(), name="name_value", + ) + + +def test_create_custom_metric( + transport: str = "grpc", request_type=analytics_admin.CreateCustomMetricRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + response = client.create_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +def test_create_custom_metric_from_dict(): + test_create_custom_metric(request_type=dict) + + +def test_create_custom_metric_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + client.create_custom_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomMetricRequest() + + +@pytest.mark.asyncio +async def test_create_custom_metric_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.CreateCustomMetricRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + ) + response = await client.create_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.CreateCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +@pytest.mark.asyncio +async def test_create_custom_metric_async_from_dict(): + await test_create_custom_metric_async(request_type=dict) + + +def test_create_custom_metric_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateCustomMetricRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + call.return_value = resources.CustomMetric() + client.create_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_create_custom_metric_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.CreateCustomMetricRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + await client.create_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_create_custom_metric_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.create_custom_metric( + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + assert args[0].custom_metric == resources.CustomMetric(name="name_value") + + +def test_create_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.create_custom_metric( + analytics_admin.CreateCustomMetricRequest(), + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + +@pytest.mark.asyncio +async def test_create_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.create_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.create_custom_metric( + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + assert args[0].custom_metric == resources.CustomMetric(name="name_value") + + +@pytest.mark.asyncio +async def test_create_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.create_custom_metric( + analytics_admin.CreateCustomMetricRequest(), + parent="parent_value", + custom_metric=resources.CustomMetric(name="name_value"), + ) + + +def test_update_custom_metric( + transport: str = "grpc", request_type=analytics_admin.UpdateCustomMetricRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + response = client.update_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +def test_update_custom_metric_from_dict(): + test_update_custom_metric(request_type=dict) + + +def test_update_custom_metric_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + client.update_custom_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomMetricRequest() + + +@pytest.mark.asyncio +async def test_update_custom_metric_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateCustomMetricRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + ) + response = await client.update_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +@pytest.mark.asyncio +async def test_update_custom_metric_async_from_dict(): + await test_update_custom_metric_async(request_type=dict) + + +def test_update_custom_metric_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.UpdateCustomMetricRequest() + + request.custom_metric.name = "custom_metric.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + call.return_value = resources.CustomMetric() + client.update_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "custom_metric.name=custom_metric.name/value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_custom_metric_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.UpdateCustomMetricRequest() + + request.custom_metric.name = "custom_metric.name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + await client.update_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ( + "x-goog-request-params", + "custom_metric.name=custom_metric.name/value", + ) in kw["metadata"] + + +def test_update_custom_metric_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_custom_metric( + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].custom_metric == resources.CustomMetric(name="name_value") + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + + +def test_update_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_custom_metric( + analytics_admin.UpdateCustomMetricRequest(), + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_custom_metric( + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].custom_metric == resources.CustomMetric(name="name_value") + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) + + +@pytest.mark.asyncio +async def test_update_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.update_custom_metric( + analytics_admin.UpdateCustomMetricRequest(), + custom_metric=resources.CustomMetric(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_list_custom_metrics( + transport: str = "grpc", request_type=analytics_admin.ListCustomMetricsRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomMetricsResponse( + next_page_token="next_page_token_value", + ) + response = client.list_custom_metrics(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomMetricsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomMetricsPager) + assert response.next_page_token == "next_page_token_value" + + +def test_list_custom_metrics_from_dict(): + test_list_custom_metrics(request_type=dict) + + +def test_list_custom_metrics_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + client.list_custom_metrics() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomMetricsRequest() + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ListCustomMetricsRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomMetricsResponse( + next_page_token="next_page_token_value", + ) + ) + response = await client.list_custom_metrics(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ListCustomMetricsRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, pagers.ListCustomMetricsAsyncPager) + assert response.next_page_token == "next_page_token_value" + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async_from_dict(): + await test_list_custom_metrics_async(request_type=dict) + + +def test_list_custom_metrics_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListCustomMetricsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + call.return_value = analytics_admin.ListCustomMetricsResponse() + client.list_custom_metrics(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_list_custom_metrics_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ListCustomMetricsRequest() + + request.parent = "parent/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomMetricsResponse() + ) + await client.list_custom_metrics(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "parent=parent/value",) in kw["metadata"] + + +def test_list_custom_metrics_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomMetricsResponse() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.list_custom_metrics(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + + +def test_list_custom_metrics_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.list_custom_metrics( + analytics_admin.ListCustomMetricsRequest(), parent="parent_value", + ) + + +@pytest.mark.asyncio +async def test_list_custom_metrics_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = analytics_admin.ListCustomMetricsResponse() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + analytics_admin.ListCustomMetricsResponse() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.list_custom_metrics(parent="parent_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].parent == "parent_value" + + +@pytest.mark.asyncio +async def test_list_custom_metrics_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.list_custom_metrics( + analytics_admin.ListCustomMetricsRequest(), parent="parent_value", + ) + + +def test_list_custom_metrics_pager(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], + ), + RuntimeError, + ) + + metadata = () + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata((("parent", ""),)), + ) + pager = client.list_custom_metrics(request={}) + + assert pager._metadata == metadata + + results = [i for i in pager] + assert len(results) == 6 + assert all(isinstance(i, resources.CustomMetric) for i in results) + + +def test_list_custom_metrics_pages(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), "__call__" + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], + ), + RuntimeError, + ) + pages = list(client.list_custom_metrics(request={}).pages) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async_pager(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], + ), + RuntimeError, + ) + async_pager = await client.list_custom_metrics(request={},) + assert async_pager.next_page_token == "abc" + responses = [] + async for response in async_pager: + responses.append(response) + + assert len(responses) == 6 + assert all(isinstance(i, resources.CustomMetric) for i in responses) + + +@pytest.mark.asyncio +async def test_list_custom_metrics_async_pages(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials, + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.list_custom_metrics), + "__call__", + new_callable=mock.AsyncMock, + ) as call: + # Set the response to a series of pages. + call.side_effect = ( + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[ + resources.CustomMetric(), + resources.CustomMetric(), + resources.CustomMetric(), + ], + next_page_token="abc", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[], next_page_token="def", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(),], next_page_token="ghi", + ), + analytics_admin.ListCustomMetricsResponse( + custom_metrics=[resources.CustomMetric(), resources.CustomMetric(),], + ), + RuntimeError, + ) + pages = [] + async for page_ in (await client.list_custom_metrics(request={})).pages: + pages.append(page_) + for page_, token in zip(pages, ["abc", "def", "ghi", ""]): + assert page_.raw_page.next_page_token == token + + +def test_archive_custom_metric( + transport: str = "grpc", request_type=analytics_admin.ArchiveCustomMetricRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + response = client.archive_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +def test_archive_custom_metric_from_dict(): + test_archive_custom_metric(request_type=dict) + + +def test_archive_custom_metric_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + client.archive_custom_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + + +@pytest.mark.asyncio +async def test_archive_custom_metric_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.ArchiveCustomMetricRequest, +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + response = await client.archive_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert response is None + + +@pytest.mark.asyncio +async def test_archive_custom_metric_async_from_dict(): + await test_archive_custom_metric_async(request_type=dict) + + +def test_archive_custom_metric_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ArchiveCustomMetricRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + call.return_value = None + client.archive_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_archive_custom_metric_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.ArchiveCustomMetricRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + await client.archive_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_archive_custom_metric_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.archive_custom_metric(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +def test_archive_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.archive_custom_metric( + analytics_admin.ArchiveCustomMetricRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_archive_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.archive_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = None + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.archive_custom_metric(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_archive_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.archive_custom_metric( + analytics_admin.ArchiveCustomMetricRequest(), name="name_value", + ) + + +def test_get_custom_metric( + transport: str = "grpc", request_type=analytics_admin.GetCustomMetricRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + response = client.get_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +def test_get_custom_metric_from_dict(): + test_get_custom_metric(request_type=dict) + + +def test_get_custom_metric_empty_call(): + # This test is a coverage failsafe to make sure that totally empty calls, + # i.e. request == None and no flattened fields passed, work. + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="grpc", + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + client.get_custom_metric() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomMetricRequest() + + +@pytest.mark.asyncio +async def test_get_custom_metric_async( + transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest +): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), transport=transport, + ) + + # Everything is optional in proto3 as far as the runtime is concerned, + # and we are mocking out the actual API, so just send an empty request. + request = request_type() + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric( + name="name_value", + parameter_name="parameter_name_value", + display_name="display_name_value", + description="description_value", + measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, + scope=resources.CustomMetric.MetricScope.EVENT, + ) + ) + response = await client.get_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.GetCustomMetricRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.CustomMetric) + assert response.name == "name_value" + assert response.parameter_name == "parameter_name_value" + assert response.display_name == "display_name_value" + assert response.description == "description_value" + assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD + assert response.scope == resources.CustomMetric.MetricScope.EVENT + + +@pytest.mark.asyncio +async def test_get_custom_metric_async_from_dict(): + await test_get_custom_metric_async(request_type=dict) + + +def test_get_custom_metric_field_headers(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetCustomMetricRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + call.return_value = resources.CustomMetric() + client.get_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_get_custom_metric_field_headers_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Any value that is part of the HTTP/1.1 URI should be sent as + # a field header. Set these to a non-empty value. + request = analytics_admin.GetCustomMetricRequest() + + request.name = "name/value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + await client.get_custom_metric(request) + + # Establish that the underlying gRPC stub method was called. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0] == request + + # Establish that the field header was sent. + _, _, kw = call.mock_calls[0] + assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + + +def test_get_custom_metric_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.get_custom_metric(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) == 1 + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +def test_get_custom_metric_flattened_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.get_custom_metric( + analytics_admin.GetCustomMetricRequest(), name="name_value", + ) + + +@pytest.mark.asyncio +async def test_get_custom_metric_flattened_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.get_custom_metric), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.CustomMetric() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.CustomMetric() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.get_custom_metric(name="name_value",) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(call.mock_calls) + _, args, _ = call.mock_calls[0] + assert args[0].name == "name_value" + + +@pytest.mark.asyncio +async def test_get_custom_metric_flattened_error_async(): + client = AnalyticsAdminServiceAsyncClient( + credentials=ga_credentials.AnonymousCredentials(), + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + await client.get_custom_metric( + analytics_admin.GetCustomMetricRequest(), name="name_value", ) - pages = [] - async for page_ in (await client.list_custom_metrics(request={})).pages: - pages.append(page_) - for page_, token in zip(pages, ["abc", "def", "ghi", ""]): - assert page_.raw_page.next_page_token == token -def test_archive_custom_metric( - transport: str = "grpc", request_type=analytics_admin.ArchiveCustomMetricRequest +def test_get_data_retention_settings( + transport: str = "grpc", + request_type=analytics_admin.GetDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17526,26 +20761,36 @@ def test_archive_custom_metric( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None - response = client.archive_custom_metric(request) + call.return_value = resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, + ) + response = client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_archive_custom_metric_from_dict(): - test_archive_custom_metric(request_type=dict) +def test_get_data_retention_settings_from_dict(): + test_get_data_retention_settings(request_type=dict) -def test_archive_custom_metric_empty_call(): +def test_get_data_retention_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17554,18 +20799,18 @@ def test_archive_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - client.archive_custom_metric() + client.get_data_retention_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() @pytest.mark.asyncio -async def test_archive_custom_metric_async( +async def test_get_data_retention_settings_async( transport: str = "grpc_asyncio", - request_type=analytics_admin.ArchiveCustomMetricRequest, + request_type=analytics_admin.GetDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17577,43 +20822,55 @@ async def test_archive_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - response = await client.archive_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings( + name="name_value", + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, + ) + ) + response = await client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.ArchiveCustomMetricRequest() + assert args[0] == analytics_admin.GetDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert response is None + assert isinstance(response, resources.DataRetentionSettings) + assert response.name == "name_value" + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True @pytest.mark.asyncio -async def test_archive_custom_metric_async_from_dict(): - await test_archive_custom_metric_async(request_type=dict) +async def test_get_data_retention_settings_async_from_dict(): + await test_get_data_retention_settings_async(request_type=dict) -def test_archive_custom_metric_field_headers(): +def test_get_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomMetricRequest() + request = analytics_admin.GetDataRetentionSettingsRequest() request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - call.return_value = None - client.archive_custom_metric(request) + call.return_value = resources.DataRetentionSettings() + client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17626,23 +20883,25 @@ def test_archive_custom_metric_field_headers(): @pytest.mark.asyncio -async def test_archive_custom_metric_field_headers_async(): +async def test_get_data_retention_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.ArchiveCustomMetricRequest() + request = analytics_admin.GetDataRetentionSettingsRequest() request.name = "name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) - await client.archive_custom_metric(request) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings() + ) + await client.get_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17654,20 +20913,20 @@ async def test_archive_custom_metric_field_headers_async(): assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] -def test_archive_custom_metric_flattened(): +def test_get_data_retention_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DataRetentionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.archive_custom_metric(name="name_value",) + client.get_data_retention_settings(name="name_value",) # Establish that the underlying call was made with the expected # request object values. @@ -17676,7 +20935,7 @@ def test_archive_custom_metric_flattened(): assert args[0].name == "name_value" -def test_archive_custom_metric_flattened_error(): +def test_get_data_retention_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17684,28 +20943,30 @@ def test_archive_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.archive_custom_metric( - analytics_admin.ArchiveCustomMetricRequest(), name="name_value", + client.get_data_retention_settings( + analytics_admin.GetDataRetentionSettingsRequest(), name="name_value", ) @pytest.mark.asyncio -async def test_archive_custom_metric_flattened_async(): +async def test_get_data_retention_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.archive_custom_metric), "__call__" + type(client.transport.get_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = None + call.return_value = resources.DataRetentionSettings() - call.return_value = grpc_helpers_async.FakeUnaryUnaryCall(None) + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.DataRetentionSettings() + ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.archive_custom_metric(name="name_value",) + response = await client.get_data_retention_settings(name="name_value",) # Establish that the underlying call was made with the expected # request object values. @@ -17715,7 +20976,7 @@ async def test_archive_custom_metric_flattened_async(): @pytest.mark.asyncio -async def test_archive_custom_metric_flattened_error_async(): +async def test_get_data_retention_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17723,13 +20984,14 @@ async def test_archive_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.archive_custom_metric( - analytics_admin.ArchiveCustomMetricRequest(), name="name_value", + await client.get_data_retention_settings( + analytics_admin.GetDataRetentionSettingsRequest(), name="name_value", ) -def test_get_custom_metric( - transport: str = "grpc", request_type=analytics_admin.GetCustomMetricRequest +def test_update_data_retention_settings( + transport: str = "grpc", + request_type=analytics_admin.UpdateDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17741,39 +21003,36 @@ def test_get_custom_metric( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric( + call.return_value = resources.DataRetentionSettings( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, ) - response = client.get_custom_metric(request) + response = client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataRetentionSettings) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True -def test_get_custom_metric_from_dict(): - test_get_custom_metric(request_type=dict) +def test_update_data_retention_settings_from_dict(): + test_update_data_retention_settings(request_type=dict) -def test_get_custom_metric_empty_call(): +def test_update_data_retention_settings_empty_call(): # This test is a coverage failsafe to make sure that totally empty calls, # i.e. request == None and no flattened fields passed, work. client = AnalyticsAdminServiceClient( @@ -17782,17 +21041,18 @@ def test_get_custom_metric_empty_call(): # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: - client.get_custom_metric() + client.update_data_retention_settings() call.assert_called() _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() @pytest.mark.asyncio -async def test_get_custom_metric_async( - transport: str = "grpc_asyncio", request_type=analytics_admin.GetCustomMetricRequest +async def test_update_data_retention_settings_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateDataRetentionSettingsRequest, ): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), transport=transport, @@ -17804,58 +21064,55 @@ async def test_get_custom_metric_async( # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric( + resources.DataRetentionSettings( name="name_value", - parameter_name="parameter_name_value", - display_name="display_name_value", - description="description_value", - measurement_unit=resources.CustomMetric.MeasurementUnit.STANDARD, - scope=resources.CustomMetric.MetricScope.EVENT, + event_data_retention=resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS, + reset_user_data_on_new_activity=True, ) ) - response = await client.get_custom_metric(request) + response = await client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0] == analytics_admin.GetCustomMetricRequest() + assert args[0] == analytics_admin.UpdateDataRetentionSettingsRequest() # Establish that the response is the type that we expect. - assert isinstance(response, resources.CustomMetric) + assert isinstance(response, resources.DataRetentionSettings) assert response.name == "name_value" - assert response.parameter_name == "parameter_name_value" - assert response.display_name == "display_name_value" - assert response.description == "description_value" - assert response.measurement_unit == resources.CustomMetric.MeasurementUnit.STANDARD - assert response.scope == resources.CustomMetric.MetricScope.EVENT + assert ( + response.event_data_retention + == resources.DataRetentionSettings.RetentionDuration.TWO_MONTHS + ) + assert response.reset_user_data_on_new_activity is True @pytest.mark.asyncio -async def test_get_custom_metric_async_from_dict(): - await test_get_custom_metric_async(request_type=dict) +async def test_update_data_retention_settings_async_from_dict(): + await test_update_data_retention_settings_async(request_type=dict) -def test_get_custom_metric_field_headers(): +def test_update_data_retention_settings_field_headers(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomMetricRequest() + request = analytics_admin.UpdateDataRetentionSettingsRequest() - request.name = "name/value" + request.data_retention_settings.name = "data_retention_settings.name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: - call.return_value = resources.CustomMetric() - client.get_custom_metric(request) + call.return_value = resources.DataRetentionSettings() + client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) == 1 @@ -17864,29 +21121,32 @@ def test_get_custom_metric_field_headers(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "data_retention_settings.name=data_retention_settings.name/value", + ) in kw["metadata"] @pytest.mark.asyncio -async def test_get_custom_metric_field_headers_async(): +async def test_update_data_retention_settings_field_headers_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Any value that is part of the HTTP/1.1 URI should be sent as # a field header. Set these to a non-empty value. - request = analytics_admin.GetCustomMetricRequest() + request = analytics_admin.UpdateDataRetentionSettingsRequest() - request.name = "name/value" + request.data_retention_settings.name = "data_retention_settings.name/value" # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataRetentionSettings() ) - await client.get_custom_metric(request) + await client.update_data_retention_settings(request) # Establish that the underlying gRPC stub method was called. assert len(call.mock_calls) @@ -17895,32 +21155,41 @@ async def test_get_custom_metric_field_headers_async(): # Establish that the field header was sent. _, _, kw = call.mock_calls[0] - assert ("x-goog-request-params", "name=name/value",) in kw["metadata"] + assert ( + "x-goog-request-params", + "data_retention_settings.name=data_retention_settings.name/value", + ) in kw["metadata"] -def test_get_custom_metric_flattened(): +def test_update_data_retention_settings_flattened(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataRetentionSettings() # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - client.get_custom_metric(name="name_value",) + client.update_data_retention_settings( + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) == 1 _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + assert args[0].data_retention_settings == resources.DataRetentionSettings( + name="name_value" + ) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) -def test_get_custom_metric_flattened_error(): +def test_update_data_retention_settings_flattened_error(): client = AnalyticsAdminServiceClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17928,40 +21197,48 @@ def test_get_custom_metric_flattened_error(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - client.get_custom_metric( - analytics_admin.GetCustomMetricRequest(), name="name_value", + client.update_data_retention_settings( + analytics_admin.UpdateDataRetentionSettingsRequest(), + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @pytest.mark.asyncio -async def test_get_custom_metric_flattened_async(): +async def test_update_data_retention_settings_flattened_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) # Mock the actual call within the gRPC stub, and fake the request. with mock.patch.object( - type(client.transport.get_custom_metric), "__call__" + type(client.transport.update_data_retention_settings), "__call__" ) as call: # Designate an appropriate return value for the call. - call.return_value = resources.CustomMetric() + call.return_value = resources.DataRetentionSettings() call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( - resources.CustomMetric() + resources.DataRetentionSettings() ) # Call the method with a truthy value for each flattened field, # using the keyword arguments to the method. - response = await client.get_custom_metric(name="name_value",) + response = await client.update_data_retention_settings( + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) # Establish that the underlying call was made with the expected # request object values. assert len(call.mock_calls) _, args, _ = call.mock_calls[0] - assert args[0].name == "name_value" + assert args[0].data_retention_settings == resources.DataRetentionSettings( + name="name_value" + ) + assert args[0].update_mask == field_mask_pb2.FieldMask(paths=["paths_value"]) @pytest.mark.asyncio -async def test_get_custom_metric_flattened_error_async(): +async def test_update_data_retention_settings_flattened_error_async(): client = AnalyticsAdminServiceAsyncClient( credentials=ga_credentials.AnonymousCredentials(), ) @@ -17969,8 +21246,10 @@ async def test_get_custom_metric_flattened_error_async(): # Attempting to call a method with both a request object and flattened # fields is an error. with pytest.raises(ValueError): - await client.get_custom_metric( - analytics_admin.GetCustomMetricRequest(), name="name_value", + await client.update_data_retention_settings( + analytics_admin.UpdateDataRetentionSettingsRequest(), + data_retention_settings=resources.DataRetentionSettings(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), ) @@ -18110,7 +21389,6 @@ def test_analytics_admin_service_base_transport(): "get_enhanced_measurement_settings", "update_enhanced_measurement_settings", "create_firebase_link", - "update_firebase_link", "delete_firebase_link", "list_firebase_links", "get_global_site_tag", @@ -18131,6 +21409,17 @@ def test_analytics_admin_service_base_transport(): "get_conversion_event", "delete_conversion_event", "list_conversion_events", + "get_display_video360_advertiser_link", + "list_display_video360_advertiser_links", + "create_display_video360_advertiser_link", + "delete_display_video360_advertiser_link", + "update_display_video360_advertiser_link", + "get_display_video360_advertiser_link_proposal", + "list_display_video360_advertiser_link_proposals", + "create_display_video360_advertiser_link_proposal", + "delete_display_video360_advertiser_link_proposal", + "approve_display_video360_advertiser_link_proposal", + "cancel_display_video360_advertiser_link_proposal", "create_custom_dimension", "update_custom_dimension", "list_custom_dimensions", @@ -18141,6 +21430,8 @@ def test_analytics_admin_service_base_transport(): "list_custom_metrics", "archive_custom_metric", "get_custom_metric", + "get_data_retention_settings", + "update_data_retention_settings", ) for method in methods: with pytest.raises(NotImplementedError): @@ -18650,8 +21941,26 @@ def test_parse_custom_metric_path(): assert expected == actual +def test_data_retention_settings_path(): + property = "oyster" + expected = "properties/{property}/dataRetentionSettings".format(property=property,) + actual = AnalyticsAdminServiceClient.data_retention_settings_path(property) + assert expected == actual + + +def test_parse_data_retention_settings_path(): + expected = { + "property": "nudibranch", + } + path = AnalyticsAdminServiceClient.data_retention_settings_path(**expected) + + # Check that the path construction is reversible. + actual = AnalyticsAdminServiceClient.parse_data_retention_settings_path(path) + assert expected == actual + + def test_data_sharing_settings_path(): - account = "oyster" + account = "cuttlefish" expected = "accounts/{account}/dataSharingSettings".format(account=account,) actual = AnalyticsAdminServiceClient.data_sharing_settings_path(account) assert expected == actual @@ -18659,7 +21968,7 @@ def test_data_sharing_settings_path(): def test_parse_data_sharing_settings_path(): expected = { - "account": "nudibranch", + "account": "mussel", } path = AnalyticsAdminServiceClient.data_sharing_settings_path(**expected) @@ -18668,9 +21977,65 @@ def test_parse_data_sharing_settings_path(): assert expected == actual +def test_display_video360_advertiser_link_path(): + property = "winkle" + display_video_360_advertiser_link = "nautilus" + expected = "properties/{property}/displayVideo360AdvertiserLinks/{display_video_360_advertiser_link}".format( + property=property, + display_video_360_advertiser_link=display_video_360_advertiser_link, + ) + actual = AnalyticsAdminServiceClient.display_video360_advertiser_link_path( + property, display_video_360_advertiser_link + ) + assert expected == actual + + +def test_parse_display_video360_advertiser_link_path(): + expected = { + "property": "scallop", + "display_video_360_advertiser_link": "abalone", + } + path = AnalyticsAdminServiceClient.display_video360_advertiser_link_path(**expected) + + # Check that the path construction is reversible. + actual = AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_path( + path + ) + assert expected == actual + + +def test_display_video360_advertiser_link_proposal_path(): + property = "squid" + display_video_360_advertiser_link_proposal = "clam" + expected = "properties/{property}/displayVideo360AdvertiserLinkProposals/{display_video_360_advertiser_link_proposal}".format( + property=property, + display_video_360_advertiser_link_proposal=display_video_360_advertiser_link_proposal, + ) + actual = AnalyticsAdminServiceClient.display_video360_advertiser_link_proposal_path( + property, display_video_360_advertiser_link_proposal + ) + assert expected == actual + + +def test_parse_display_video360_advertiser_link_proposal_path(): + expected = { + "property": "whelk", + "display_video_360_advertiser_link_proposal": "octopus", + } + path = AnalyticsAdminServiceClient.display_video360_advertiser_link_proposal_path( + **expected + ) + + # Check that the path construction is reversible. + actual = AnalyticsAdminServiceClient.parse_display_video360_advertiser_link_proposal_path( + path + ) + assert expected == actual + + def test_enhanced_measurement_settings_path(): - property = "cuttlefish" - web_data_stream = "mussel" + property = "oyster" + web_data_stream = "nudibranch" expected = "properties/{property}/webDataStreams/{web_data_stream}/enhancedMeasurementSettings".format( property=property, web_data_stream=web_data_stream, ) @@ -18682,8 +22047,8 @@ def test_enhanced_measurement_settings_path(): def test_parse_enhanced_measurement_settings_path(): expected = { - "property": "winkle", - "web_data_stream": "nautilus", + "property": "cuttlefish", + "web_data_stream": "mussel", } path = AnalyticsAdminServiceClient.enhanced_measurement_settings_path(**expected) @@ -18693,8 +22058,8 @@ def test_parse_enhanced_measurement_settings_path(): def test_firebase_link_path(): - property = "scallop" - firebase_link = "abalone" + property = "winkle" + firebase_link = "nautilus" expected = "properties/{property}/firebaseLinks/{firebase_link}".format( property=property, firebase_link=firebase_link, ) @@ -18704,8 +22069,8 @@ def test_firebase_link_path(): def test_parse_firebase_link_path(): expected = { - "property": "squid", - "firebase_link": "clam", + "property": "scallop", + "firebase_link": "abalone", } path = AnalyticsAdminServiceClient.firebase_link_path(**expected) @@ -18715,7 +22080,7 @@ def test_parse_firebase_link_path(): def test_global_site_tag_path(): - property = "whelk" + property = "squid" expected = "properties/{property}/globalSiteTag".format(property=property,) actual = AnalyticsAdminServiceClient.global_site_tag_path(property) assert expected == actual @@ -18723,7 +22088,7 @@ def test_global_site_tag_path(): def test_parse_global_site_tag_path(): expected = { - "property": "octopus", + "property": "clam", } path = AnalyticsAdminServiceClient.global_site_tag_path(**expected) @@ -18733,8 +22098,8 @@ def test_parse_global_site_tag_path(): def test_google_ads_link_path(): - property = "oyster" - google_ads_link = "nudibranch" + property = "whelk" + google_ads_link = "octopus" expected = "properties/{property}/googleAdsLinks/{google_ads_link}".format( property=property, google_ads_link=google_ads_link, ) @@ -18744,8 +22109,8 @@ def test_google_ads_link_path(): def test_parse_google_ads_link_path(): expected = { - "property": "cuttlefish", - "google_ads_link": "mussel", + "property": "oyster", + "google_ads_link": "nudibranch", } path = AnalyticsAdminServiceClient.google_ads_link_path(**expected) @@ -18755,7 +22120,7 @@ def test_parse_google_ads_link_path(): def test_google_signals_settings_path(): - property = "winkle" + property = "cuttlefish" expected = "properties/{property}/googleSignalsSettings".format(property=property,) actual = AnalyticsAdminServiceClient.google_signals_settings_path(property) assert expected == actual @@ -18763,7 +22128,7 @@ def test_google_signals_settings_path(): def test_parse_google_signals_settings_path(): expected = { - "property": "nautilus", + "property": "mussel", } path = AnalyticsAdminServiceClient.google_signals_settings_path(**expected) @@ -18773,8 +22138,8 @@ def test_parse_google_signals_settings_path(): def test_ios_app_data_stream_path(): - property = "scallop" - ios_app_data_stream = "abalone" + property = "winkle" + ios_app_data_stream = "nautilus" expected = "properties/{property}/iosAppDataStreams/{ios_app_data_stream}".format( property=property, ios_app_data_stream=ios_app_data_stream, ) @@ -18786,8 +22151,8 @@ def test_ios_app_data_stream_path(): def test_parse_ios_app_data_stream_path(): expected = { - "property": "squid", - "ios_app_data_stream": "clam", + "property": "scallop", + "ios_app_data_stream": "abalone", } path = AnalyticsAdminServiceClient.ios_app_data_stream_path(**expected) @@ -18797,9 +22162,9 @@ def test_parse_ios_app_data_stream_path(): def test_measurement_protocol_secret_path(): - property = "whelk" - web_data_stream = "octopus" - measurement_protocol_secret = "oyster" + property = "squid" + web_data_stream = "clam" + measurement_protocol_secret = "whelk" expected = "properties/{property}/webDataStreams/{web_data_stream}/measurementProtocolSecrets/{measurement_protocol_secret}".format( property=property, web_data_stream=web_data_stream, @@ -18813,9 +22178,9 @@ def test_measurement_protocol_secret_path(): def test_parse_measurement_protocol_secret_path(): expected = { - "property": "nudibranch", - "web_data_stream": "cuttlefish", - "measurement_protocol_secret": "mussel", + "property": "octopus", + "web_data_stream": "oyster", + "measurement_protocol_secret": "nudibranch", } path = AnalyticsAdminServiceClient.measurement_protocol_secret_path(**expected) @@ -18825,7 +22190,7 @@ def test_parse_measurement_protocol_secret_path(): def test_property_path(): - property = "winkle" + property = "cuttlefish" expected = "properties/{property}".format(property=property,) actual = AnalyticsAdminServiceClient.property_path(property) assert expected == actual @@ -18833,7 +22198,7 @@ def test_property_path(): def test_parse_property_path(): expected = { - "property": "nautilus", + "property": "mussel", } path = AnalyticsAdminServiceClient.property_path(**expected) @@ -18843,8 +22208,8 @@ def test_parse_property_path(): def test_user_link_path(): - account = "scallop" - user_link = "abalone" + account = "winkle" + user_link = "nautilus" expected = "accounts/{account}/userLinks/{user_link}".format( account=account, user_link=user_link, ) @@ -18854,8 +22219,8 @@ def test_user_link_path(): def test_parse_user_link_path(): expected = { - "account": "squid", - "user_link": "clam", + "account": "scallop", + "user_link": "abalone", } path = AnalyticsAdminServiceClient.user_link_path(**expected) @@ -18865,8 +22230,8 @@ def test_parse_user_link_path(): def test_web_data_stream_path(): - property = "whelk" - web_data_stream = "octopus" + property = "squid" + web_data_stream = "clam" expected = "properties/{property}/webDataStreams/{web_data_stream}".format( property=property, web_data_stream=web_data_stream, ) @@ -18876,8 +22241,8 @@ def test_web_data_stream_path(): def test_parse_web_data_stream_path(): expected = { - "property": "oyster", - "web_data_stream": "nudibranch", + "property": "whelk", + "web_data_stream": "octopus", } path = AnalyticsAdminServiceClient.web_data_stream_path(**expected) @@ -18887,7 +22252,7 @@ def test_parse_web_data_stream_path(): def test_common_billing_account_path(): - billing_account = "cuttlefish" + billing_account = "oyster" expected = "billingAccounts/{billing_account}".format( billing_account=billing_account, ) @@ -18897,7 +22262,7 @@ def test_common_billing_account_path(): def test_parse_common_billing_account_path(): expected = { - "billing_account": "mussel", + "billing_account": "nudibranch", } path = AnalyticsAdminServiceClient.common_billing_account_path(**expected) @@ -18907,7 +22272,7 @@ def test_parse_common_billing_account_path(): def test_common_folder_path(): - folder = "winkle" + folder = "cuttlefish" expected = "folders/{folder}".format(folder=folder,) actual = AnalyticsAdminServiceClient.common_folder_path(folder) assert expected == actual @@ -18915,7 +22280,7 @@ def test_common_folder_path(): def test_parse_common_folder_path(): expected = { - "folder": "nautilus", + "folder": "mussel", } path = AnalyticsAdminServiceClient.common_folder_path(**expected) @@ -18925,7 +22290,7 @@ def test_parse_common_folder_path(): def test_common_organization_path(): - organization = "scallop" + organization = "winkle" expected = "organizations/{organization}".format(organization=organization,) actual = AnalyticsAdminServiceClient.common_organization_path(organization) assert expected == actual @@ -18933,7 +22298,7 @@ def test_common_organization_path(): def test_parse_common_organization_path(): expected = { - "organization": "abalone", + "organization": "nautilus", } path = AnalyticsAdminServiceClient.common_organization_path(**expected) @@ -18943,7 +22308,7 @@ def test_parse_common_organization_path(): def test_common_project_path(): - project = "squid" + project = "scallop" expected = "projects/{project}".format(project=project,) actual = AnalyticsAdminServiceClient.common_project_path(project) assert expected == actual @@ -18951,7 +22316,7 @@ def test_common_project_path(): def test_parse_common_project_path(): expected = { - "project": "clam", + "project": "abalone", } path = AnalyticsAdminServiceClient.common_project_path(**expected) @@ -18961,8 +22326,8 @@ def test_parse_common_project_path(): def test_common_location_path(): - project = "whelk" - location = "octopus" + project = "squid" + location = "clam" expected = "projects/{project}/locations/{location}".format( project=project, location=location, ) @@ -18972,8 +22337,8 @@ def test_common_location_path(): def test_parse_common_location_path(): expected = { - "project": "oyster", - "location": "nudibranch", + "project": "whelk", + "location": "octopus", } path = AnalyticsAdminServiceClient.common_location_path(**expected)