From a93f51a87b2fc060ef8d56497aac0625546de22d Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Tue, 1 Aug 2023 18:06:13 +0000 Subject: [PATCH 1/5] chore: [autoapprove] Pin flake8 version (#369) Source-Link: https://togithub.com/googleapis/synthtool/commit/0ddbff8012e47cde4462fe3f9feab01fbc4cdfd6 Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b --- .github/.OwlBot.lock.yaml | 4 ++-- .pre-commit-config.yaml | 2 +- noxfile.py | 3 ++- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index 0ddd0e4d..d71329cc 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:6c1cbc75c74b8bdd71dada2fa1677e9d6d78a889e9a70ee75b93d1d0543f96e1 -# created: 2023-07-25T21:01:10.396410762Z + digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b +# created: 2023-08-01T17:41:45.434027321Z diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 9e3898fd..19409cbd 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -26,6 +26,6 @@ repos: hooks: - id: black - repo: https://github.com/pycqa/flake8 - rev: 3.9.2 + rev: 6.1.0 hooks: - id: flake8 diff --git a/noxfile.py b/noxfile.py index 3773a35f..40007331 100644 --- a/noxfile.py +++ b/noxfile.py @@ -26,6 +26,7 @@ import nox +FLAKE8_VERSION = "flake8==6.1.0" BLACK_VERSION = "black==22.3.0" ISORT_VERSION = "isort==5.10.1" LINT_PATHS = ["docs", "google", "tests", "noxfile.py", "setup.py"] @@ -82,7 +83,7 @@ def lint(session): Returns a failure if the linters find linting errors or sufficiently serious code quality issues. """ - session.install("flake8", BLACK_VERSION) + session.install(FLAKE8_VERSION, BLACK_VERSION) session.run( "black", "--check", From daa2ccd41756b3e83f1b882c7d43269f62494e54 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Wed, 2 Aug 2023 11:18:13 +0000 Subject: [PATCH 2/5] build: [autoapprove] bump cryptography from 41.0.2 to 41.0.3 (#371) Source-Link: https://togithub.com/googleapis/synthtool/commit/352b9d4c068ce7c05908172af128b294073bf53c Post-Processor: gcr.io/cloud-devrel-public-resources/owlbot-python:latest@sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 --- .github/.OwlBot.lock.yaml | 4 ++-- .kokoro/requirements.txt | 48 +++++++++++++++++++-------------------- 2 files changed, 26 insertions(+), 26 deletions(-) diff --git a/.github/.OwlBot.lock.yaml b/.github/.OwlBot.lock.yaml index d71329cc..a3da1b0d 100644 --- a/.github/.OwlBot.lock.yaml +++ b/.github/.OwlBot.lock.yaml @@ -13,5 +13,5 @@ # limitations under the License. docker: image: gcr.io/cloud-devrel-public-resources/owlbot-python:latest - digest: sha256:bced5ca77c4dda0fd2f5d845d4035fc3c5d3d6b81f245246a36aee114970082b -# created: 2023-08-01T17:41:45.434027321Z + digest: sha256:3e3800bb100af5d7f9e810d48212b37812c1856d20ffeafb99ebe66461b61fc7 +# created: 2023-08-02T10:53:29.114535628Z diff --git a/.kokoro/requirements.txt b/.kokoro/requirements.txt index 76d9bba0..029bd342 100644 --- a/.kokoro/requirements.txt +++ b/.kokoro/requirements.txt @@ -113,30 +113,30 @@ commonmark==0.9.1 \ --hash=sha256:452f9dc859be7f06631ddcb328b6919c67984aca654e5fefb3914d54691aed60 \ --hash=sha256:da2f38c92590f83de410ba1a3cbceafbc74fee9def35f9251ba9a971d6d66fd9 # via rich -cryptography==41.0.2 \ - --hash=sha256:01f1d9e537f9a15b037d5d9ee442b8c22e3ae11ce65ea1f3316a41c78756b711 \ - --hash=sha256:079347de771f9282fbfe0e0236c716686950c19dee1b76240ab09ce1624d76d7 \ - --hash=sha256:182be4171f9332b6741ee818ec27daff9fb00349f706629f5cbf417bd50e66fd \ - --hash=sha256:192255f539d7a89f2102d07d7375b1e0a81f7478925b3bc2e0549ebf739dae0e \ - --hash=sha256:2a034bf7d9ca894720f2ec1d8b7b5832d7e363571828037f9e0c4f18c1b58a58 \ - --hash=sha256:342f3767e25876751e14f8459ad85e77e660537ca0a066e10e75df9c9e9099f0 \ - --hash=sha256:439c3cc4c0d42fa999b83ded80a9a1fb54d53c58d6e59234cfe97f241e6c781d \ - --hash=sha256:49c3222bb8f8e800aead2e376cbef687bc9e3cb9b58b29a261210456a7783d83 \ - --hash=sha256:674b669d5daa64206c38e507808aae49904c988fa0a71c935e7006a3e1e83831 \ - --hash=sha256:7a9a3bced53b7f09da251685224d6a260c3cb291768f54954e28f03ef14e3766 \ - --hash=sha256:7af244b012711a26196450d34f483357e42aeddb04128885d95a69bd8b14b69b \ - --hash=sha256:7d230bf856164de164ecb615ccc14c7fc6de6906ddd5b491f3af90d3514c925c \ - --hash=sha256:84609ade00a6ec59a89729e87a503c6e36af98ddcd566d5f3be52e29ba993182 \ - --hash=sha256:9a6673c1828db6270b76b22cc696f40cde9043eb90373da5c2f8f2158957f42f \ - --hash=sha256:9b6d717393dbae53d4e52684ef4f022444fc1cce3c48c38cb74fca29e1f08eaa \ - --hash=sha256:9c3fe6534d59d071ee82081ca3d71eed3210f76ebd0361798c74abc2bcf347d4 \ - --hash=sha256:a719399b99377b218dac6cf547b6ec54e6ef20207b6165126a280b0ce97e0d2a \ - --hash=sha256:b332cba64d99a70c1e0836902720887fb4529ea49ea7f5462cf6640e095e11d2 \ - --hash=sha256:d124682c7a23c9764e54ca9ab5b308b14b18eba02722b8659fb238546de83a76 \ - --hash=sha256:d73f419a56d74fef257955f51b18d046f3506270a5fd2ac5febbfa259d6c0fa5 \ - --hash=sha256:f0dc40e6f7aa37af01aba07277d3d64d5a03dc66d682097541ec4da03cc140ee \ - --hash=sha256:f14ad275364c8b4e525d018f6716537ae7b6d369c094805cae45300847e0894f \ - --hash=sha256:f772610fe364372de33d76edcd313636a25684edb94cee53fd790195f5989d14 +cryptography==41.0.3 \ + --hash=sha256:0d09fb5356f975974dbcb595ad2d178305e5050656affb7890a1583f5e02a306 \ + --hash=sha256:23c2d778cf829f7d0ae180600b17e9fceea3c2ef8b31a99e3c694cbbf3a24b84 \ + --hash=sha256:3fb248989b6363906827284cd20cca63bb1a757e0a2864d4c1682a985e3dca47 \ + --hash=sha256:41d7aa7cdfded09b3d73a47f429c298e80796c8e825ddfadc84c8a7f12df212d \ + --hash=sha256:42cb413e01a5d36da9929baa9d70ca90d90b969269e5a12d39c1e0d475010116 \ + --hash=sha256:4c2f0d35703d61002a2bbdcf15548ebb701cfdd83cdc12471d2bae80878a4207 \ + --hash=sha256:4fd871184321100fb400d759ad0cddddf284c4b696568204d281c902fc7b0d81 \ + --hash=sha256:5259cb659aa43005eb55a0e4ff2c825ca111a0da1814202c64d28a985d33b087 \ + --hash=sha256:57a51b89f954f216a81c9d057bf1a24e2f36e764a1ca9a501a6964eb4a6800dd \ + --hash=sha256:652627a055cb52a84f8c448185922241dd5217443ca194d5739b44612c5e6507 \ + --hash=sha256:67e120e9a577c64fe1f611e53b30b3e69744e5910ff3b6e97e935aeb96005858 \ + --hash=sha256:6af1c6387c531cd364b72c28daa29232162010d952ceb7e5ca8e2827526aceae \ + --hash=sha256:6d192741113ef5e30d89dcb5b956ef4e1578f304708701b8b73d38e3e1461f34 \ + --hash=sha256:7efe8041897fe7a50863e51b77789b657a133c75c3b094e51b5e4b5cec7bf906 \ + --hash=sha256:84537453d57f55a50a5b6835622ee405816999a7113267739a1b4581f83535bd \ + --hash=sha256:8f09daa483aedea50d249ef98ed500569841d6498aa9c9f4b0531b9964658922 \ + --hash=sha256:95dd7f261bb76948b52a5330ba5202b91a26fbac13ad0e9fc8a3ac04752058c7 \ + --hash=sha256:a74fbcdb2a0d46fe00504f571a2a540532f4c188e6ccf26f1f178480117b33c4 \ + --hash=sha256:a983e441a00a9d57a4d7c91b3116a37ae602907a7618b882c8013b5762e80574 \ + --hash=sha256:ab8de0d091acbf778f74286f4989cf3d1528336af1b59f3e5d2ebca8b5fe49e1 \ + --hash=sha256:aeb57c421b34af8f9fe830e1955bf493a86a7996cc1338fe41b30047d16e962c \ + --hash=sha256:ce785cf81a7bdade534297ef9e490ddff800d956625020ab2ec2780a556c313e \ + --hash=sha256:d0d651aa754ef58d75cec6edfbd21259d93810b73f6ec246436a21b7841908de # via # gcp-releasetool # secretstorage From 5759848b80679c61df408ec5a2ee9f445b5aba36 Mon Sep 17 00:00:00 2001 From: Mend Renovate Date: Wed, 9 Aug 2023 15:34:23 +0200 Subject: [PATCH 3/5] chore(deps): update dependency google-analytics-admin to v0.19.0 (#368) Co-authored-by: Anthonios Partheniou --- samples/requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/samples/requirements.txt b/samples/requirements.txt index 4c8c7a06..2930d6c0 100644 --- a/samples/requirements.txt +++ b/samples/requirements.txt @@ -1,2 +1,2 @@ -google-analytics-admin==0.18.1 +google-analytics-admin==0.19.0 google-auth-oauthlib==1.0.0 \ No newline at end of file From 7685881c45f9a58158ccf8dbb625c9d8f91bc4b2 Mon Sep 17 00:00:00 2001 From: "gcf-owl-bot[bot]" <78513119+gcf-owl-bot[bot]@users.noreply.github.com> Date: Thu, 10 Aug 2023 07:09:17 -0400 Subject: [PATCH 4/5] fix: rename the `intraday_export_enabled` field to `enterprise_export_enabled` in the `BigQueryLink` resource (#372) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * fix!: rename the `enterprise_daily_export_enabled` field to `fresh_daily_export_enabled` in the `BigQueryLink` resource feat: add `UpdateConversionEvent` method to the Admin API v1 alpha feat: add the `counting_method` field to the `ConversionEvent` type feat: add the `ConversionCountingMethod` enum PiperOrigin-RevId: 555379699 Source-Link: https://github.com/googleapis/googleapis/commit/a9a67de598742dae67aa1b38ba6492dcebc71be0 Source-Link: https://github.com/googleapis/googleapis-gen/commit/31b8966b65d9232b5b396d73be6578086ffc6718 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMzFiODk2NmI2NWQ5MjMyYjViMzk2ZDczYmU2NTc4MDg2ZmZjNjcxOCJ9 * 🦉 Updates from OwlBot post-processor See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --------- Co-authored-by: Owl Bot --- google/analytics/admin/__init__.py | 2 + google/analytics/admin_v1alpha/__init__.py | 2 + .../admin_v1alpha/gapic_metadata.json | 15 + .../analytics_admin_service/async_client.py | 119 ++++ .../analytics_admin_service/client.py | 119 ++++ .../transports/base.py | 14 + .../transports/grpc.py | 29 + .../transports/grpc_asyncio.py | 30 + .../transports/rest.py | 143 ++++ .../analytics/admin_v1alpha/types/__init__.py | 2 + .../admin_v1alpha/types/analytics_admin.py | 27 + .../admin_v1alpha/types/resources.py | 33 +- ...n_service_update_conversion_event_async.py | 51 ++ ...in_service_update_conversion_event_sync.py | 51 ++ ...tadata_google.analytics.admin.v1alpha.json | 171 ++++- ...etadata_google.analytics.admin.v1beta.json | 2 +- scripts/fixup_admin_v1alpha_keywords.py | 1 + .../test_analytics_admin_service.py | 636 +++++++++++++++++- 18 files changed, 1436 insertions(+), 11 deletions(-) create mode 100644 samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py create mode 100644 samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py diff --git a/google/analytics/admin/__init__.py b/google/analytics/admin/__init__.py index 5b0cb8e4..f8df51cf 100644 --- a/google/analytics/admin/__init__.py +++ b/google/analytics/admin/__init__.py @@ -192,6 +192,7 @@ UpdateAttributionSettingsRequest, UpdateAudienceRequest, UpdateChannelGroupRequest, + UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, UpdateDataRetentionSettingsRequest, @@ -447,6 +448,7 @@ "UpdateAttributionSettingsRequest", "UpdateAudienceRequest", "UpdateChannelGroupRequest", + "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", "UpdateDataRetentionSettingsRequest", diff --git a/google/analytics/admin_v1alpha/__init__.py b/google/analytics/admin_v1alpha/__init__.py index bd840070..8373d494 100644 --- a/google/analytics/admin_v1alpha/__init__.py +++ b/google/analytics/admin_v1alpha/__init__.py @@ -190,6 +190,7 @@ UpdateAttributionSettingsRequest, UpdateAudienceRequest, UpdateChannelGroupRequest, + UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, UpdateDataRetentionSettingsRequest, @@ -505,6 +506,7 @@ "UpdateAttributionSettingsRequest", "UpdateAudienceRequest", "UpdateChannelGroupRequest", + "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", "UpdateDataRetentionSettingsRequest", diff --git a/google/analytics/admin_v1alpha/gapic_metadata.json b/google/analytics/admin_v1alpha/gapic_metadata.json index bcad6ca9..b0d8d089 100644 --- a/google/analytics/admin_v1alpha/gapic_metadata.json +++ b/google/analytics/admin_v1alpha/gapic_metadata.json @@ -550,6 +550,11 @@ "update_channel_group" ] }, + "UpdateConversionEvent": { + "methods": [ + "update_conversion_event" + ] + }, "UpdateCustomDimension": { "methods": [ "update_custom_dimension" @@ -1165,6 +1170,11 @@ "update_channel_group" ] }, + "UpdateConversionEvent": { + "methods": [ + "update_conversion_event" + ] + }, "UpdateCustomDimension": { "methods": [ "update_custom_dimension" @@ -1780,6 +1790,11 @@ "update_channel_group" ] }, + "UpdateConversionEvent": { + "methods": [ + "update_conversion_event" + ] + }, "UpdateCustomDimension": { "methods": [ "update_custom_dimension" diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py index 0cef7d35..84e3ab12 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/async_client.py @@ -4516,6 +4516,125 @@ async def sample_create_conversion_event(): # Done; return the response. return response + async def update_conversion_event( + self, + request: Optional[ + Union[analytics_admin.UpdateConversionEventRequest, dict] + ] = None, + *, + conversion_event: Optional[resources.ConversionEvent] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.ConversionEvent: + r"""Updates a conversion event with the specified + attributes. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.analytics import admin_v1alpha + + async def sample_update_conversion_event(): + # Create a client + client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + + # Initialize request argument(s) + request = admin_v1alpha.UpdateConversionEventRequest( + ) + + # Make the request + response = await client.update_conversion_event(request=request) + + # Handle the response + print(response) + + Args: + request (Optional[Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]]): + The request object. Request message for + UpdateConversionEvent RPC + conversion_event (:class:`google.analytics.admin_v1alpha.types.ConversionEvent`): + Required. The conversion event to update. The ``name`` + field is used to identify the settings to be updated. + + This corresponds to the ``conversion_event`` 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.ConversionEvent: + A conversion event in a Google + Analytics property. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([conversion_event, 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.UpdateConversionEventRequest(request) + + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if conversion_event is not None: + request.conversion_event = conversion_event + 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_conversion_event, + 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( + (("conversion_event.name", request.conversion_event.name),) + ), + ) + + # Send the request. + response = await rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + async def get_conversion_event( self, request: Optional[ diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py index 01c922c8..4511c122 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/client.py @@ -5129,6 +5129,125 @@ def sample_create_conversion_event(): # Done; return the response. return response + def update_conversion_event( + self, + request: Optional[ + Union[analytics_admin.UpdateConversionEventRequest, dict] + ] = None, + *, + conversion_event: Optional[resources.ConversionEvent] = None, + update_mask: Optional[field_mask_pb2.FieldMask] = None, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Union[float, object] = gapic_v1.method.DEFAULT, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.ConversionEvent: + r"""Updates a conversion event with the specified + attributes. + + .. code-block:: python + + # This snippet has been automatically generated and should be regarded as a + # code template only. + # It will require modifications to work: + # - It may require correct/in-range values for request initialization. + # - It may require specifying regional endpoints when creating the service + # client as shown in: + # https://googleapis.dev/python/google-api-core/latest/client_options.html + from google.analytics import admin_v1alpha + + def sample_update_conversion_event(): + # Create a client + client = admin_v1alpha.AnalyticsAdminServiceClient() + + # Initialize request argument(s) + request = admin_v1alpha.UpdateConversionEventRequest( + ) + + # Make the request + response = client.update_conversion_event(request=request) + + # Handle the response + print(response) + + Args: + request (Union[google.analytics.admin_v1alpha.types.UpdateConversionEventRequest, dict]): + The request object. Request message for + UpdateConversionEvent RPC + conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): + Required. The conversion event to update. The ``name`` + field is used to identify the settings to be updated. + + This corresponds to the ``conversion_event`` 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.ConversionEvent: + A conversion event in a Google + Analytics property. + + """ + # Create or coerce a protobuf request object. + # Quick check: If we got a request object, we should *not* have + # gotten any keyword arguments that map to the request. + has_flattened_params = any([conversion_event, 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.UpdateConversionEventRequest. + # There's no risk of modifying the input as we've already verified + # there are no flattened fields. + if not isinstance(request, analytics_admin.UpdateConversionEventRequest): + request = analytics_admin.UpdateConversionEventRequest(request) + # If we have keyword arguments corresponding to fields on the + # request, apply these. + if conversion_event is not None: + request.conversion_event = conversion_event + 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_conversion_event] + + # Certain fields should be provided within the metadata header; + # add these here. + metadata = tuple(metadata) + ( + gapic_v1.routing_header.to_grpc_metadata( + (("conversion_event.name", request.conversion_event.name),) + ), + ) + + # Send the request. + response = rpc( + request, + retry=retry, + timeout=timeout, + metadata=metadata, + ) + + # Done; return the response. + return response + def get_conversion_event( self, request: Optional[ diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py index dc0eb35c..e3584559 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/base.py @@ -338,6 +338,11 @@ def _prep_wrapped_messages(self, client_info): default_timeout=None, client_info=client_info, ), + self.update_conversion_event: gapic_v1.method.wrap_method( + self.update_conversion_event, + default_timeout=None, + client_info=client_info, + ), self.get_conversion_event: gapic_v1.method.wrap_method( self.get_conversion_event, default_timeout=None, @@ -1174,6 +1179,15 @@ def create_conversion_event( ]: raise NotImplementedError() + @property + def update_conversion_event( + self, + ) -> Callable[ + [analytics_admin.UpdateConversionEventRequest], + Union[resources.ConversionEvent, Awaitable[resources.ConversionEvent]], + ]: + raise NotImplementedError() + @property def get_conversion_event( self, diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py index b933144f..5dbe6ac2 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc.py @@ -1429,6 +1429,35 @@ def create_conversion_event( ) return self._stubs["create_conversion_event"] + @property + def update_conversion_event( + self, + ) -> Callable[ + [analytics_admin.UpdateConversionEventRequest], resources.ConversionEvent + ]: + r"""Return a callable for the update conversion event method over gRPC. + + Updates a conversion event with the specified + attributes. + + Returns: + Callable[[~.UpdateConversionEventRequest], + ~.ConversionEvent]: + 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_conversion_event" not in self._stubs: + self._stubs["update_conversion_event"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateConversionEvent", + request_serializer=analytics_admin.UpdateConversionEventRequest.serialize, + response_deserializer=resources.ConversionEvent.deserialize, + ) + return self._stubs["update_conversion_event"] + @property def get_conversion_event( self, diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py index 888b422a..319064dc 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/grpc_asyncio.py @@ -1459,6 +1459,36 @@ def create_conversion_event( ) return self._stubs["create_conversion_event"] + @property + def update_conversion_event( + self, + ) -> Callable[ + [analytics_admin.UpdateConversionEventRequest], + Awaitable[resources.ConversionEvent], + ]: + r"""Return a callable for the update conversion event method over gRPC. + + Updates a conversion event with the specified + attributes. + + Returns: + Callable[[~.UpdateConversionEventRequest], + Awaitable[~.ConversionEvent]]: + 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_conversion_event" not in self._stubs: + self._stubs["update_conversion_event"] = self.grpc_channel.unary_unary( + "/google.analytics.admin.v1alpha.AnalyticsAdminService/UpdateConversionEvent", + request_serializer=analytics_admin.UpdateConversionEventRequest.serialize, + response_deserializer=resources.ConversionEvent.deserialize, + ) + return self._stubs["update_conversion_event"] + @property def get_conversion_event( self, diff --git a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py index bff85e7f..f16d5cbf 100644 --- a/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py +++ b/google/analytics/admin_v1alpha/services/analytics_admin_service/transports/rest.py @@ -855,6 +855,14 @@ def post_update_channel_group(self, response): logging.log(f"Received response: {response}") return response + def pre_update_conversion_event(self, request, metadata): + logging.log(f"Received request: {request}") + return request, metadata + + def post_update_conversion_event(self, response): + logging.log(f"Received response: {response}") + return response + def pre_update_custom_dimension(self, request, metadata): logging.log(f"Received request: {request}") return request, metadata @@ -3296,6 +3304,29 @@ def post_update_channel_group( """ return response + def pre_update_conversion_event( + self, + request: analytics_admin.UpdateConversionEventRequest, + metadata: Sequence[Tuple[str, str]], + ) -> Tuple[analytics_admin.UpdateConversionEventRequest, Sequence[Tuple[str, str]]]: + """Pre-rpc interceptor for update_conversion_event + + Override in a subclass to manipulate the request or metadata + before they are sent to the AnalyticsAdminService server. + """ + return request, metadata + + def post_update_conversion_event( + self, response: resources.ConversionEvent + ) -> resources.ConversionEvent: + """Post-rpc interceptor for update_conversion_event + + Override in a subclass to manipulate the response + after it is returned by the AnalyticsAdminService server but before + it is returned to user code. + """ + return response + def pre_update_custom_dimension( self, request: analytics_admin.UpdateCustomDimensionRequest, @@ -13870,6 +13901,108 @@ def __call__( resp = self._interceptor.post_update_channel_group(resp) return resp + class _UpdateConversionEvent(AnalyticsAdminServiceRestStub): + def __hash__(self): + return hash("UpdateConversionEvent") + + __REQUIRED_FIELDS_DEFAULT_VALUES: Dict[str, Any] = { + "updateMask": {}, + } + + @classmethod + def _get_unset_required_fields(cls, message_dict): + return { + k: v + for k, v in cls.__REQUIRED_FIELDS_DEFAULT_VALUES.items() + if k not in message_dict + } + + def __call__( + self, + request: analytics_admin.UpdateConversionEventRequest, + *, + retry: OptionalRetry = gapic_v1.method.DEFAULT, + timeout: Optional[float] = None, + metadata: Sequence[Tuple[str, str]] = (), + ) -> resources.ConversionEvent: + r"""Call the update conversion event method over HTTP. + + Args: + request (~.analytics_admin.UpdateConversionEventRequest): + The request object. Request message for + UpdateConversionEvent 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: + ~.resources.ConversionEvent: + A conversion event in a Google + Analytics property. + + """ + + http_options: List[Dict[str, str]] = [ + { + "method": "patch", + "uri": "/v1alpha/{conversion_event.name=properties/*/conversionEvents/*}", + "body": "conversion_event", + }, + ] + request, metadata = self._interceptor.pre_update_conversion_event( + request, metadata + ) + pb_request = analytics_admin.UpdateConversionEventRequest.pb(request) + transcoded_request = path_template.transcode(http_options, pb_request) + + # Jsonify the request body + + body = json_format.MessageToJson( + transcoded_request["body"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + uri = transcoded_request["uri"] + method = transcoded_request["method"] + + # Jsonify the query params + query_params = json.loads( + json_format.MessageToJson( + transcoded_request["query_params"], + including_default_value_fields=False, + use_integers_for_enums=True, + ) + ) + query_params.update(self._get_unset_required_fields(query_params)) + + query_params["$alt"] = "json;enum-encoding=int" + + # Send the request + headers = dict(metadata) + headers["Content-Type"] = "application/json" + response = getattr(self._session, method)( + "{host}{uri}".format(host=self._host, uri=uri), + timeout=timeout, + headers=headers, + params=rest_helpers.flatten_query_params(query_params, strict=True), + data=body, + ) + + # In case of error, raise the appropriate core_exceptions.GoogleAPICallError exception + # subclass. + if response.status_code >= 400: + raise core_exceptions.from_http_response(response) + + # Return the response + resp = resources.ConversionEvent() + pb_resp = resources.ConversionEvent.pb(resp) + + json_format.Parse(response.content, pb_resp, ignore_unknown_fields=True) + resp = self._interceptor.post_update_conversion_event(resp) + return resp + class _UpdateCustomDimension(AnalyticsAdminServiceRestStub): def __hash__(self): return hash("UpdateCustomDimension") @@ -16379,6 +16512,16 @@ def update_channel_group( # In C++ this would require a dynamic_cast return self._UpdateChannelGroup(self._session, self._host, self._interceptor) # type: ignore + @property + def update_conversion_event( + self, + ) -> Callable[ + [analytics_admin.UpdateConversionEventRequest], resources.ConversionEvent + ]: + # The return type is fine, but mypy isn't sophisticated enough to determine what's going on here. + # In C++ this would require a dynamic_cast + return self._UpdateConversionEvent(self._session, self._host, self._interceptor) # type: ignore + @property def update_custom_dimension( self, diff --git a/google/analytics/admin_v1alpha/types/__init__.py b/google/analytics/admin_v1alpha/types/__init__.py index 784ed7c7..f7265dd7 100644 --- a/google/analytics/admin_v1alpha/types/__init__.py +++ b/google/analytics/admin_v1alpha/types/__init__.py @@ -181,6 +181,7 @@ UpdateAttributionSettingsRequest, UpdateAudienceRequest, UpdateChannelGroupRequest, + UpdateConversionEventRequest, UpdateCustomDimensionRequest, UpdateCustomMetricRequest, UpdateDataRetentionSettingsRequest, @@ -430,6 +431,7 @@ "UpdateAttributionSettingsRequest", "UpdateAudienceRequest", "UpdateChannelGroupRequest", + "UpdateConversionEventRequest", "UpdateCustomDimensionRequest", "UpdateCustomMetricRequest", "UpdateDataRetentionSettingsRequest", diff --git a/google/analytics/admin_v1alpha/types/analytics_admin.py b/google/analytics/admin_v1alpha/types/analytics_admin.py index 9e9922d2..46b2e581 100644 --- a/google/analytics/admin_v1alpha/types/analytics_admin.py +++ b/google/analytics/admin_v1alpha/types/analytics_admin.py @@ -89,6 +89,7 @@ "GetGoogleSignalsSettingsRequest", "UpdateGoogleSignalsSettingsRequest", "CreateConversionEventRequest", + "UpdateConversionEventRequest", "GetConversionEventRequest", "DeleteConversionEventRequest", "ListConversionEventsRequest", @@ -1770,6 +1771,32 @@ class CreateConversionEventRequest(proto.Message): ) +class UpdateConversionEventRequest(proto.Message): + r"""Request message for UpdateConversionEvent RPC + + Attributes: + conversion_event (google.analytics.admin_v1alpha.types.ConversionEvent): + Required. The conversion event 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. + """ + + conversion_event: resources.ConversionEvent = proto.Field( + proto.MESSAGE, + number=1, + message=resources.ConversionEvent, + ) + update_mask: field_mask_pb2.FieldMask = proto.Field( + proto.MESSAGE, + number=2, + message=field_mask_pb2.FieldMask, + ) + + class GetConversionEventRequest(proto.Message): r"""Request message for GetConversionEvent RPC diff --git a/google/analytics/admin_v1alpha/types/resources.py b/google/analytics/admin_v1alpha/types/resources.py index bebea2f1..55b3e2ad 100644 --- a/google/analytics/admin_v1alpha/types/resources.py +++ b/google/analytics/admin_v1alpha/types/resources.py @@ -1814,8 +1814,30 @@ class ConversionEvent(proto.Message): Custom events count towards the maximum number of custom conversion events that may be created per property. + counting_method (google.analytics.admin_v1alpha.types.ConversionEvent.ConversionCountingMethod): + Optional. The method by which conversions will be counted + across multiple events within a session. If this value is + not provided, it will be set to ``ONCE_PER_EVENT``. """ + class ConversionCountingMethod(proto.Enum): + r"""The method by which conversions will be counted across + multiple events within a session. + + Values: + CONVERSION_COUNTING_METHOD_UNSPECIFIED (0): + Counting method not specified. + ONCE_PER_EVENT (1): + Each Event instance is considered a + Conversion. + ONCE_PER_SESSION (2): + An Event instance is considered a Conversion + at most once per session per user. + """ + CONVERSION_COUNTING_METHOD_UNSPECIFIED = 0 + ONCE_PER_EVENT = 1 + ONCE_PER_SESSION = 2 + name: str = proto.Field( proto.STRING, number=1, @@ -1837,6 +1859,11 @@ class ConversionEvent(proto.Message): proto.BOOL, number=5, ) + counting_method: ConversionCountingMethod = proto.Field( + proto.ENUM, + number=6, + enum=ConversionCountingMethod, + ) class GoogleSignalsSettings(proto.Message): @@ -2433,8 +2460,8 @@ class BigQueryLink(proto.Message): streaming_export_enabled (bool): If set true, enables streaming export to the linked Google Cloud project. - intraday_export_enabled (bool): - If set true, enables intraday export to the + enterprise_export_enabled (bool): + If set true, enables enterprise export to the linked Google Cloud project. include_advertising_id (bool): If set true, exported data will include @@ -2470,7 +2497,7 @@ class BigQueryLink(proto.Message): proto.BOOL, number=5, ) - intraday_export_enabled: bool = proto.Field( + enterprise_export_enabled: bool = proto.Field( proto.BOOL, number=9, ) diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py new file mode 100644 index 00000000..80f3f20f --- /dev/null +++ b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConversionEvent +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-analytics-admin + + +# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.analytics import admin_v1alpha + + +async def sample_update_conversion_event(): + # Create a client + client = admin_v1alpha.AnalyticsAdminServiceAsyncClient() + + # Initialize request argument(s) + request = admin_v1alpha.UpdateConversionEventRequest( + ) + + # Make the request + response = await client.update_conversion_event(request=request) + + # Handle the response + print(response) + +# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async] diff --git a/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py new file mode 100644 index 00000000..1cd10a15 --- /dev/null +++ b/samples/generated_samples/analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py @@ -0,0 +1,51 @@ +# -*- coding: utf-8 -*- +# Copyright 2023 Google LLC +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# +# Generated code. DO NOT EDIT! +# +# Snippet for UpdateConversionEvent +# NOTE: This snippet has been automatically generated for illustrative purposes only. +# It may require modifications to work in your environment. + +# To install the latest published package dependency, execute the following: +# python3 -m pip install google-analytics-admin + + +# [START analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync] +# This snippet has been automatically generated and should be regarded as a +# code template only. +# It will require modifications to work: +# - It may require correct/in-range values for request initialization. +# - It may require specifying regional endpoints when creating the service +# client as shown in: +# https://googleapis.dev/python/google-api-core/latest/client_options.html +from google.analytics import admin_v1alpha + + +def sample_update_conversion_event(): + # Create a client + client = admin_v1alpha.AnalyticsAdminServiceClient() + + # Initialize request argument(s) + request = admin_v1alpha.UpdateConversionEventRequest( + ) + + # Make the request + response = client.update_conversion_event(request=request) + + # Handle the response + print(response) + +# [END analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync] diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json index e77e7023..ed33d769 100644 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json +++ b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-analytics-admin", - "version": "0.19.0" + "version": "0.1.0" }, "snippets": [ { @@ -17241,6 +17241,175 @@ ], "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_channel_group_sync.py" }, + { + "canonical": true, + "clientMethod": { + "async": true, + "client": { + "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient", + "shortName": "AnalyticsAdminServiceAsyncClient" + }, + "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceAsyncClient.update_conversion_event", + "method": { + "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateConversionEvent", + "service": { + "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", + "shortName": "AnalyticsAdminService" + }, + "shortName": "UpdateConversionEvent" + }, + "parameters": [ + { + "name": "request", + "type": "google.analytics.admin_v1alpha.types.UpdateConversionEventRequest" + }, + { + "name": "conversion_event", + "type": "google.analytics.admin_v1alpha.types.ConversionEvent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", + "shortName": "update_conversion_event" + }, + "description": "Sample for UpdateConversionEvent", + "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_async", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_async.py" + }, + { + "canonical": true, + "clientMethod": { + "client": { + "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient", + "shortName": "AnalyticsAdminServiceClient" + }, + "fullName": "google.analytics.admin_v1alpha.AnalyticsAdminServiceClient.update_conversion_event", + "method": { + "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService.UpdateConversionEvent", + "service": { + "fullName": "google.analytics.admin.v1alpha.AnalyticsAdminService", + "shortName": "AnalyticsAdminService" + }, + "shortName": "UpdateConversionEvent" + }, + "parameters": [ + { + "name": "request", + "type": "google.analytics.admin_v1alpha.types.UpdateConversionEventRequest" + }, + { + "name": "conversion_event", + "type": "google.analytics.admin_v1alpha.types.ConversionEvent" + }, + { + "name": "update_mask", + "type": "google.protobuf.field_mask_pb2.FieldMask" + }, + { + "name": "retry", + "type": "google.api_core.retry.Retry" + }, + { + "name": "timeout", + "type": "float" + }, + { + "name": "metadata", + "type": "Sequence[Tuple[str, str]" + } + ], + "resultType": "google.analytics.admin_v1alpha.types.ConversionEvent", + "shortName": "update_conversion_event" + }, + "description": "Sample for UpdateConversionEvent", + "file": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py", + "language": "PYTHON", + "origin": "API_DEFINITION", + "regionTag": "analyticsadmin_v1alpha_generated_AnalyticsAdminService_UpdateConversionEvent_sync", + "segments": [ + { + "end": 50, + "start": 27, + "type": "FULL" + }, + { + "end": 50, + "start": 27, + "type": "SHORT" + }, + { + "end": 40, + "start": 38, + "type": "CLIENT_INITIALIZATION" + }, + { + "end": 44, + "start": 41, + "type": "REQUEST_INITIALIZATION" + }, + { + "end": 47, + "start": 45, + "type": "REQUEST_EXECUTION" + }, + { + "end": 51, + "start": 48, + "type": "RESPONSE_HANDLING" + } + ], + "title": "analyticsadmin_v1alpha_generated_analytics_admin_service_update_conversion_event_sync.py" + }, { "canonical": true, "clientMethod": { diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json index 888bbe08..89e737a3 100644 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json +++ b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-analytics-admin", - "version": "0.19.0" + "version": "0.1.0" }, "snippets": [ { diff --git a/scripts/fixup_admin_v1alpha_keywords.py b/scripts/fixup_admin_v1alpha_keywords.py index 4a549844..dc6ba1f3 100644 --- a/scripts/fixup_admin_v1alpha_keywords.py +++ b/scripts/fixup_admin_v1alpha_keywords.py @@ -147,6 +147,7 @@ class adminCallTransformer(cst.CSTTransformer): 'update_attribution_settings': ('attribution_settings', 'update_mask', ), 'update_audience': ('audience', 'update_mask', ), 'update_channel_group': ('channel_group', 'update_mask', ), + 'update_conversion_event': ('conversion_event', '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', ), diff --git a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py index c7cc845f..edd8ded3 100644 --- a/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py +++ b/tests/unit/gapic/admin_v1alpha/test_analytics_admin_service.py @@ -10956,6 +10956,7 @@ def test_create_conversion_event(request_type, transport: str = "grpc"): event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) response = client.create_conversion_event(request) @@ -10970,6 +10971,10 @@ def test_create_conversion_event(request_type, transport: str = "grpc"): assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) def test_create_conversion_event_empty_call(): @@ -11015,6 +11020,7 @@ async def test_create_conversion_event_async( event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) ) response = await client.create_conversion_event(request) @@ -11030,6 +11036,10 @@ async def test_create_conversion_event_async( assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) @pytest.mark.asyncio @@ -11198,6 +11208,285 @@ async def test_create_conversion_event_flattened_error_async(): ) +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateConversionEventRequest, + dict, + ], +) +def test_update_conversion_event(request_type, transport: str = "grpc"): + 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_conversion_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + response = client.update_conversion_event(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.UpdateConversionEventRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) + + +def test_update_conversion_event_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_conversion_event), "__call__" + ) as call: + client.update_conversion_event() + call.assert_called() + _, args, _ = call.mock_calls[0] + assert args[0] == analytics_admin.UpdateConversionEventRequest() + + +@pytest.mark.asyncio +async def test_update_conversion_event_async( + transport: str = "grpc_asyncio", + request_type=analytics_admin.UpdateConversionEventRequest, +): + 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_conversion_event), "__call__" + ) as call: + # 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", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + ) + response = await client.update_conversion_event(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.UpdateConversionEventRequest() + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) + + +@pytest.mark.asyncio +async def test_update_conversion_event_async_from_dict(): + await test_update_conversion_event_async(request_type=dict) + + +def test_update_conversion_event_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.UpdateConversionEventRequest() + + request.conversion_event.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_conversion_event), "__call__" + ) as call: + call.return_value = resources.ConversionEvent() + client.update_conversion_event(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", + "conversion_event.name=name_value", + ) in kw["metadata"] + + +@pytest.mark.asyncio +async def test_update_conversion_event_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.UpdateConversionEventRequest() + + request.conversion_event.name = "name_value" + + # Mock the actual call within the gRPC stub, and fake the request. + with mock.patch.object( + type(client.transport.update_conversion_event), "__call__" + ) as call: + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.ConversionEvent() + ) + await client.update_conversion_event(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", + "conversion_event.name=name_value", + ) in kw["metadata"] + + +def test_update_conversion_event_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_conversion_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.ConversionEvent() + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + client.update_conversion_event( + conversion_event=resources.ConversionEvent(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] + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +def test_update_conversion_event_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_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +@pytest.mark.asyncio +async def test_update_conversion_event_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_conversion_event), "__call__" + ) as call: + # Designate an appropriate return value for the call. + call.return_value = resources.ConversionEvent() + + call.return_value = grpc_helpers_async.FakeUnaryUnaryCall( + resources.ConversionEvent() + ) + # Call the method with a truthy value for each flattened field, + # using the keyword arguments to the method. + response = await client.update_conversion_event( + conversion_event=resources.ConversionEvent(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] + arg = args[0].conversion_event + mock_val = resources.ConversionEvent(name="name_value") + assert arg == mock_val + arg = args[0].update_mask + mock_val = field_mask_pb2.FieldMask(paths=["paths_value"]) + assert arg == mock_val + + +@pytest.mark.asyncio +async def test_update_conversion_event_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_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + @pytest.mark.parametrize( "request_type", [ @@ -11225,6 +11514,7 @@ def test_get_conversion_event(request_type, transport: str = "grpc"): event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) response = client.get_conversion_event(request) @@ -11239,6 +11529,10 @@ def test_get_conversion_event(request_type, transport: str = "grpc"): assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) def test_get_conversion_event_empty_call(): @@ -11284,6 +11578,7 @@ async def test_get_conversion_event_async( event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) ) response = await client.get_conversion_event(request) @@ -11299,6 +11594,10 @@ async def test_get_conversion_event_async( assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) @pytest.mark.asyncio @@ -29181,7 +29480,7 @@ def test_get_big_query_link(request_type, transport: str = "grpc"): project="project_value", daily_export_enabled=True, streaming_export_enabled=True, - intraday_export_enabled=True, + enterprise_export_enabled=True, include_advertising_id=True, export_streams=["export_streams_value"], excluded_events=["excluded_events_value"], @@ -29199,7 +29498,7 @@ def test_get_big_query_link(request_type, transport: str = "grpc"): assert response.project == "project_value" assert response.daily_export_enabled is True assert response.streaming_export_enabled is True - assert response.intraday_export_enabled is True + assert response.enterprise_export_enabled is True assert response.include_advertising_id is True assert response.export_streams == ["export_streams_value"] assert response.excluded_events == ["excluded_events_value"] @@ -29247,7 +29546,7 @@ async def test_get_big_query_link_async( project="project_value", daily_export_enabled=True, streaming_export_enabled=True, - intraday_export_enabled=True, + enterprise_export_enabled=True, include_advertising_id=True, export_streams=["export_streams_value"], excluded_events=["excluded_events_value"], @@ -29266,7 +29565,7 @@ async def test_get_big_query_link_async( assert response.project == "project_value" assert response.daily_export_enabled is True assert response.streaming_export_enabled is True - assert response.intraday_export_enabled is True + assert response.enterprise_export_enabled is True assert response.include_advertising_id is True assert response.export_streams == ["export_streams_value"] assert response.excluded_events == ["excluded_events_value"] @@ -44125,6 +44424,7 @@ def test_create_conversion_event_rest(request_type): "create_time": {"seconds": 751, "nanos": 543}, "deletable": True, "custom": True, + "counting_method": 1, } request = request_type(**request_init) @@ -44136,6 +44436,7 @@ def test_create_conversion_event_rest(request_type): event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) # Wrap the value into a proper Response obj @@ -44154,6 +44455,10 @@ def test_create_conversion_event_rest(request_type): assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) def test_create_conversion_event_rest_required_fields( @@ -44324,6 +44629,7 @@ def test_create_conversion_event_rest_bad_request( "create_time": {"seconds": 751, "nanos": 543}, "deletable": True, "custom": True, + "counting_method": 1, } request = request_type(**request_init) @@ -44403,6 +44709,315 @@ def test_create_conversion_event_rest_error(): ) +@pytest.mark.parametrize( + "request_type", + [ + analytics_admin.UpdateConversionEventRequest, + dict, + ], +) +def test_update_conversion_event_rest(request_type): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # send a request that will satisfy transcoding + request_init = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + } + request_init["conversion_event"] = { + "name": "properties/sample1/conversionEvents/sample2", + "event_name": "event_name_value", + "create_time": {"seconds": 751, "nanos": 543}, + "deletable": True, + "custom": True, + "counting_method": 1, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.ConversionEvent( + name="name_value", + event_name="event_name_value", + deletable=True, + custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, + ) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + response = client.update_conversion_event(request) + + # Establish that the response is the type that we expect. + assert isinstance(response, resources.ConversionEvent) + assert response.name == "name_value" + assert response.event_name == "event_name_value" + assert response.deletable is True + assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) + + +def test_update_conversion_event_rest_required_fields( + request_type=analytics_admin.UpdateConversionEventRequest, +): + transport_class = transports.AnalyticsAdminServiceRestTransport + + request_init = {} + request = request_type(**request_init) + pb_request = request_type.pb(request) + jsonified_request = json.loads( + json_format.MessageToJson( + pb_request, + including_default_value_fields=False, + use_integers_for_enums=False, + ) + ) + + # verify fields with default values are dropped + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).update_conversion_event._get_unset_required_fields(jsonified_request) + jsonified_request.update(unset_fields) + + # verify required fields with default values are now present + + unset_fields = transport_class( + credentials=ga_credentials.AnonymousCredentials() + ).update_conversion_event._get_unset_required_fields(jsonified_request) + # Check that path parameters and body parameters are not mixing in. + assert not set(unset_fields) - set(("update_mask",)) + jsonified_request.update(unset_fields) + + # verify required fields with non-default values are left alone + + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + request = request_type(**request_init) + + # Designate an appropriate value for the returned response. + return_value = resources.ConversionEvent() + # Mock the http request call within the method and fake a response. + with mock.patch.object(Session, "request") as req: + # We need to mock transcode() because providing default values + # for required fields will fail the real version if the http_options + # expect actual values for those fields. + with mock.patch.object(path_template, "transcode") as transcode: + # A uri without fields and an empty body will force all the + # request fields to show up in the query_params. + pb_request = request_type.pb(request) + transcode_result = { + "uri": "v1/sample_method", + "method": "patch", + "query_params": pb_request, + } + transcode_result["body"] = pb_request + transcode.return_value = transcode_result + + response_value = Response() + response_value.status_code = 200 + + pb_return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + response = client.update_conversion_event(request) + + expected_params = [("$alt", "json;enum-encoding=int")] + actual_params = req.call_args.kwargs["params"] + assert expected_params == actual_params + + +def test_update_conversion_event_rest_unset_required_fields(): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials + ) + + unset_fields = transport.update_conversion_event._get_unset_required_fields({}) + assert set(unset_fields) == ( + set(("updateMask",)) + & set( + ( + "conversionEvent", + "updateMask", + ) + ) + ) + + +@pytest.mark.parametrize("null_interceptor", [True, False]) +def test_update_conversion_event_rest_interceptors(null_interceptor): + transport = transports.AnalyticsAdminServiceRestTransport( + credentials=ga_credentials.AnonymousCredentials(), + interceptor=None + if null_interceptor + else transports.AnalyticsAdminServiceRestInterceptor(), + ) + client = AnalyticsAdminServiceClient(transport=transport) + with mock.patch.object( + type(client.transport._session), "request" + ) as req, mock.patch.object( + path_template, "transcode" + ) as transcode, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "post_update_conversion_event" + ) as post, mock.patch.object( + transports.AnalyticsAdminServiceRestInterceptor, "pre_update_conversion_event" + ) as pre: + pre.assert_not_called() + post.assert_not_called() + pb_message = analytics_admin.UpdateConversionEventRequest.pb( + analytics_admin.UpdateConversionEventRequest() + ) + transcode.return_value = { + "method": "post", + "uri": "my_uri", + "body": pb_message, + "query_params": pb_message, + } + + req.return_value = Response() + req.return_value.status_code = 200 + req.return_value.request = PreparedRequest() + req.return_value._content = resources.ConversionEvent.to_json( + resources.ConversionEvent() + ) + + request = analytics_admin.UpdateConversionEventRequest() + metadata = [ + ("key", "val"), + ("cephalopod", "squid"), + ] + pre.return_value = request, metadata + post.return_value = resources.ConversionEvent() + + client.update_conversion_event( + request, + metadata=[ + ("key", "val"), + ("cephalopod", "squid"), + ], + ) + + pre.assert_called_once() + post.assert_called_once() + + +def test_update_conversion_event_rest_bad_request( + transport: str = "rest", request_type=analytics_admin.UpdateConversionEventRequest +): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # send a request that will satisfy transcoding + request_init = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + } + request_init["conversion_event"] = { + "name": "properties/sample1/conversionEvents/sample2", + "event_name": "event_name_value", + "create_time": {"seconds": 751, "nanos": 543}, + "deletable": True, + "custom": True, + "counting_method": 1, + } + request = request_type(**request_init) + + # Mock the http request call within the method and fake a BadRequest error. + with mock.patch.object(Session, "request") as req, pytest.raises( + core_exceptions.BadRequest + ): + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 400 + response_value.request = Request() + req.return_value = response_value + client.update_conversion_event(request) + + +def test_update_conversion_event_rest_flattened(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport="rest", + ) + + # Mock the http request call within the method and fake a response. + with mock.patch.object(type(client.transport._session), "request") as req: + # Designate an appropriate value for the returned response. + return_value = resources.ConversionEvent() + + # get arguments that satisfy an http rule for this method + sample_request = { + "conversion_event": {"name": "properties/sample1/conversionEvents/sample2"} + } + + # get truthy value for each flattened field + mock_args = dict( + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + mock_args.update(sample_request) + + # Wrap the value into a proper Response obj + response_value = Response() + response_value.status_code = 200 + pb_return_value = resources.ConversionEvent.pb(return_value) + json_return_value = json_format.MessageToJson(pb_return_value) + response_value._content = json_return_value.encode("UTF-8") + req.return_value = response_value + + client.update_conversion_event(**mock_args) + + # Establish that the underlying call was made with the expected + # request object values. + assert len(req.mock_calls) == 1 + _, args, _ = req.mock_calls[0] + assert path_template.validate( + "%s/v1alpha/{conversion_event.name=properties/*/conversionEvents/*}" + % client.transport._host, + args[1], + ) + + +def test_update_conversion_event_rest_flattened_error(transport: str = "rest"): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), + transport=transport, + ) + + # Attempting to call a method with both a request object and flattened + # fields is an error. + with pytest.raises(ValueError): + client.update_conversion_event( + analytics_admin.UpdateConversionEventRequest(), + conversion_event=resources.ConversionEvent(name="name_value"), + update_mask=field_mask_pb2.FieldMask(paths=["paths_value"]), + ) + + +def test_update_conversion_event_rest_error(): + client = AnalyticsAdminServiceClient( + credentials=ga_credentials.AnonymousCredentials(), transport="rest" + ) + + @pytest.mark.parametrize( "request_type", [ @@ -44428,6 +45043,7 @@ def test_get_conversion_event_rest(request_type): event_name="event_name_value", deletable=True, custom=True, + counting_method=resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT, ) # Wrap the value into a proper Response obj @@ -44446,6 +45062,10 @@ def test_get_conversion_event_rest(request_type): assert response.event_name == "event_name_value" assert response.deletable is True assert response.custom is True + assert ( + response.counting_method + == resources.ConversionEvent.ConversionCountingMethod.ONCE_PER_EVENT + ) def test_get_conversion_event_rest_required_fields( @@ -63416,7 +64036,7 @@ def test_get_big_query_link_rest(request_type): project="project_value", daily_export_enabled=True, streaming_export_enabled=True, - intraday_export_enabled=True, + enterprise_export_enabled=True, include_advertising_id=True, export_streams=["export_streams_value"], excluded_events=["excluded_events_value"], @@ -63438,7 +64058,7 @@ def test_get_big_query_link_rest(request_type): assert response.project == "project_value" assert response.daily_export_enabled is True assert response.streaming_export_enabled is True - assert response.intraday_export_enabled is True + assert response.enterprise_export_enabled is True assert response.include_advertising_id is True assert response.export_streams == ["export_streams_value"] assert response.excluded_events == ["excluded_events_value"] @@ -68189,6 +68809,7 @@ def test_analytics_admin_service_base_transport(): "get_google_signals_settings", "update_google_signals_settings", "create_conversion_event", + "update_conversion_event", "get_conversion_event", "delete_conversion_event", "list_conversion_events", @@ -68673,6 +69294,9 @@ def test_analytics_admin_service_client_transport_session_collision(transport_na session1 = client1.transport.create_conversion_event._session session2 = client2.transport.create_conversion_event._session assert session1 != session2 + session1 = client1.transport.update_conversion_event._session + session2 = client2.transport.update_conversion_event._session + assert session1 != session2 session1 = client1.transport.get_conversion_event._session session2 = client2.transport.get_conversion_event._session assert session1 != session2 From c356dc2215db14ff79a78858d6c530eb0bdfa174 Mon Sep 17 00:00:00 2001 From: "release-please[bot]" <55107282+release-please[bot]@users.noreply.github.com> Date: Thu, 10 Aug 2023 16:14:37 -0400 Subject: [PATCH 5/5] chore(main): release 0.20.0 (#373) Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com> --- .release-please-manifest.json | 2 +- CHANGELOG.md | 14 ++++++++++++++ google/analytics/admin/gapic_version.py | 2 +- google/analytics/admin_v1alpha/gapic_version.py | 2 +- google/analytics/admin_v1beta/gapic_version.py | 2 +- ...et_metadata_google.analytics.admin.v1alpha.json | 2 +- ...pet_metadata_google.analytics.admin.v1beta.json | 2 +- 7 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 19ee807a..71e95baf 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.19.0" + ".": "0.20.0" } diff --git a/CHANGELOG.md b/CHANGELOG.md index 17b83904..66767d24 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,19 @@ # Changelog +## [0.20.0](https://github.com/googleapis/python-analytics-admin/compare/v0.19.0...v0.20.0) (2023-08-10) + + +### Features + +* **v1alpha:** Add `UpdateConversionEvent` method to the Admin API v1 alpha ([7685881](https://github.com/googleapis/python-analytics-admin/commit/7685881c45f9a58158ccf8dbb625c9d8f91bc4b2)) +* **v1alpha:** Add the `ConversionCountingMethod` enum ([7685881](https://github.com/googleapis/python-analytics-admin/commit/7685881c45f9a58158ccf8dbb625c9d8f91bc4b2)) +* **v1alpha:** Add the `counting_method` field to the `ConversionEvent` type ([7685881](https://github.com/googleapis/python-analytics-admin/commit/7685881c45f9a58158ccf8dbb625c9d8f91bc4b2)) + + +### Bug Fixes + +* **v1alpha:** Rename the `intraday_export_enabled` field to `enterprise_export_enabled` in the `BigQueryLink` resource ([7685881](https://github.com/googleapis/python-analytics-admin/commit/7685881c45f9a58158ccf8dbb625c9d8f91bc4b2)) + ## [0.19.0](https://github.com/googleapis/python-analytics-admin/compare/v0.18.1...v0.19.0) (2023-07-27) diff --git a/google/analytics/admin/gapic_version.py b/google/analytics/admin/gapic_version.py index 93d656a4..8c9276c0 100644 --- a/google/analytics/admin/gapic_version.py +++ b/google/analytics/admin/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.19.0" # {x-release-please-version} +__version__ = "0.20.0" # {x-release-please-version} diff --git a/google/analytics/admin_v1alpha/gapic_version.py b/google/analytics/admin_v1alpha/gapic_version.py index 93d656a4..8c9276c0 100644 --- a/google/analytics/admin_v1alpha/gapic_version.py +++ b/google/analytics/admin_v1alpha/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.19.0" # {x-release-please-version} +__version__ = "0.20.0" # {x-release-please-version} diff --git a/google/analytics/admin_v1beta/gapic_version.py b/google/analytics/admin_v1beta/gapic_version.py index 93d656a4..8c9276c0 100644 --- a/google/analytics/admin_v1beta/gapic_version.py +++ b/google/analytics/admin_v1beta/gapic_version.py @@ -13,4 +13,4 @@ # See the License for the specific language governing permissions and # limitations under the License. # -__version__ = "0.19.0" # {x-release-please-version} +__version__ = "0.20.0" # {x-release-please-version} diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json index ed33d769..f460d3ac 100644 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json +++ b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1alpha.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-analytics-admin", - "version": "0.1.0" + "version": "0.20.0" }, "snippets": [ { diff --git a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json index 89e737a3..21dcf4f3 100644 --- a/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json +++ b/samples/generated_samples/snippet_metadata_google.analytics.admin.v1beta.json @@ -8,7 +8,7 @@ ], "language": "PYTHON", "name": "google-analytics-admin", - "version": "0.1.0" + "version": "0.20.0" }, "snippets": [ {