Ctrl + K
DocumentationLog inGet started

tessl/pypi-google-shopping-merchant-conversions

tessl install tessl/pypi-google-shopping-merchant-conversions@1.0.0

Google Shopping Merchant Conversions API client library for managing conversion sources and tracking.

Agent Success

Agent success rate when using this tile

82%

Improvement

Agent success rate improvement when using this tile compared to baseline

1.17x

Baseline

Agent success rate without this tile

70%

task.mdevals/scenario-1/

Conversion Source Version Manager

Build a utility that manages conversion sources across different API versions of the Google Shopping Merchant Conversions service.

Requirements

Create a Python module that provides a version-aware client manager for the Google Shopping Merchant Conversions API. The system should:

  1. Initialize clients for multiple API versions: Support both the stable production API and the beta preview API
  2. Version selection: Allow specifying which API version to use for operations
  3. Basic operations: Support listing conversion sources using a specified API version

Implementation Details

Create a module with a ConversionVersionManager class that:

  • Accepts merchant account ID during initialization
  • Initializes both stable and beta API clients
  • Provides a method to get the appropriate client based on version specification ('stable' or 'beta')
  • Provides a method to list conversion sources using a specified version

@generates

API

class ConversionVersionManager:
    """Manages conversion source operations across API versions."""

    def __init__(self, merchant_id: str):
        """
        Initialize the version manager.

        Args:
            merchant_id: The merchant account ID
        """
        pass

    def initialize_clients(self) -> None:
        """Initialize both stable and beta API clients."""
        pass

    def get_client(self, version: str):
        """
        Get the client for the specified version.

        Args:
            version: Either 'stable' or 'beta'

        Returns:
            The API client for the specified version

        Raises:
            ValueError: If version is not 'stable' or 'beta'
        """
        pass

    def list_sources(self, version: str = 'stable') -> list:
        """
        List conversion sources using specified API version.

        Args:
            version: Either 'stable' or 'beta', defaults to 'stable'

        Returns:
            List of conversion sources from the specified version

        Raises:
            ValueError: If version is not 'stable' or 'beta'
        """
        pass

Test Cases

  • Initialize a ConversionVersionManager with a merchant ID and verify both clients can be initialized @test
  • Get the stable client and verify it's an instance of the stable API client class @test
  • Get the beta client and verify it's an instance of the beta API client class @test
  • Call get_client with an invalid version and verify it raises a ValueError @test

Dependencies { .dependencies }

google-shopping-merchant-conversions { .dependency }

Provides the Google Shopping Merchant Conversions API client library for both stable (v1) and beta (v1beta) versions.

Version

Workspace
tessl
Visibility
Public
Created
Last updated
Describes
pypipkg:pypi/google-shopping-merchant-conversions@1.0.x
tile.json