google-analytics-cli 0.2.2__tar.gz → 0.2.3__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (110) hide show
  1. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.github/workflows/api-watch.yml +3 -1
  2. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/PKG-INFO +1 -1
  3. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/pyproject.toml +1 -1
  4. google_analytics_cli-0.2.3/src/ga_cli/commands/user_provided_data.py +56 -0
  5. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/main.py +2 -0
  6. google_analytics_cli-0.2.3/tests/test_user_provided_data.py +83 -0
  7. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.api-snapshots/analyticsadmin_v1alpha.json +0 -0
  8. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.api-snapshots/analyticsadmin_v1beta.json +0 -0
  9. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.api-snapshots/analyticsdata_v1alpha.json +0 -0
  10. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.api-snapshots/analyticsdata_v1beta.json +0 -0
  11. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.github/workflows/ci.yml +0 -0
  12. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.github/workflows/release.yml +0 -0
  13. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.gitignore +0 -0
  14. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/.python-version +0 -0
  15. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/README.md +0 -0
  16. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/install.sh +0 -0
  17. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/scripts/check_api_changes.py +0 -0
  18. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/__init__.py +0 -0
  19. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/api/__init__.py +0 -0
  20. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/api/client.py +0 -0
  21. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/auth/__init__.py +0 -0
  22. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/auth/credentials.py +0 -0
  23. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/auth/oauth.py +0 -0
  24. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/auth/service_account.py +0 -0
  25. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/__init__.py +0 -0
  26. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/access_bindings.py +0 -0
  27. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/access_reports.py +0 -0
  28. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/account_summaries.py +0 -0
  29. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/accounts.py +0 -0
  30. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/agent_cmd.py +0 -0
  31. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/annotations.py +0 -0
  32. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/audiences.py +0 -0
  33. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/auth_cmd.py +0 -0
  34. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/bigquery_links.py +0 -0
  35. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/calculated_metrics.py +0 -0
  36. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/channel_groups.py +0 -0
  37. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/completions_cmd.py +0 -0
  38. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/config_cmd.py +0 -0
  39. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/custom_dimensions.py +0 -0
  40. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/custom_metrics.py +0 -0
  41. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/data_retention.py +0 -0
  42. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/data_streams.py +0 -0
  43. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/enhanced_measurement.py +0 -0
  44. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/event_create_rules.py +0 -0
  45. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/event_edit_rules.py +0 -0
  46. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/firebase_links.py +0 -0
  47. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/google_ads_links.py +0 -0
  48. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/key_events.py +0 -0
  49. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/mp_secrets.py +0 -0
  50. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/properties.py +0 -0
  51. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/property_settings.py +0 -0
  52. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/reports.py +0 -0
  53. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/commands/upgrade_cmd.py +0 -0
  54. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/config/__init__.py +0 -0
  55. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/config/constants.py +0 -0
  56. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/config/store.py +0 -0
  57. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/__init__.py +0 -0
  58. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/describe.py +0 -0
  59. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/dry_run.py +0 -0
  60. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/errors.py +0 -0
  61. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/filters.py +0 -0
  62. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/output.py +0 -0
  63. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/src/ga_cli/utils/pagination.py +0 -0
  64. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/__init__.py +0 -0
  65. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/conftest.py +0 -0
  66. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_access_bindings.py +0 -0
  67. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_access_reports.py +0 -0
  68. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_account_summaries.py +0 -0
  69. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_accounts.py +0 -0
  70. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_agent_cmd.py +0 -0
  71. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_annotations.py +0 -0
  72. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_api_client.py +0 -0
  73. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_api_diff.py +0 -0
  74. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_audiences.py +0 -0
  75. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_auth_cmd.py +0 -0
  76. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_bigquery_links.py +0 -0
  77. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_calculated_metrics.py +0 -0
  78. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_channel_groups.py +0 -0
  79. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_completions_cmd.py +0 -0
  80. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_config_cmd.py +0 -0
  81. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_credentials.py +0 -0
  82. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_custom_dimensions.py +0 -0
  83. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_custom_metrics.py +0 -0
  84. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_data_retention.py +0 -0
  85. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_data_streams.py +0 -0
  86. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_describe.py +0 -0
  87. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_dry_run.py +0 -0
  88. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_enhanced_measurement.py +0 -0
  89. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_errors.py +0 -0
  90. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_event_create_rules.py +0 -0
  91. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_event_edit_rules.py +0 -0
  92. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_filters.py +0 -0
  93. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_firebase_links.py +0 -0
  94. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_google_ads_links.py +0 -0
  95. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_install_script.sh +0 -0
  96. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_key_events.py +0 -0
  97. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_mp_secrets.py +0 -0
  98. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_output.py +0 -0
  99. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_pagination.py +0 -0
  100. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_properties.py +0 -0
  101. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_property_settings.py +0 -0
  102. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_quiet_nocolor.py +0 -0
  103. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_reports.py +0 -0
  104. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_reports_batch.py +0 -0
  105. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_reports_funnel.py +0 -0
  106. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_reports_pivot.py +0 -0
  107. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_service_account.py +0 -0
  108. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_upgrade_cmd.py +0 -0
  109. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/tests/test_version.py +0 -0
  110. {google_analytics_cli-0.2.2 → google_analytics_cli-0.2.3}/uv.lock +0 -0
@@ -26,12 +26,14 @@ jobs:
26
26
  - name: Create GitHub Issue
27
27
  if: steps.diff.outputs.has_changes == 'true'
28
28
  uses: actions/github-script@v7
29
+ env:
30
+ ISSUE_BODY: ${{ steps.diff.outputs.issue_body }}
29
31
  with:
30
32
  script: |
31
33
  await github.rest.issues.create({
32
34
  owner: context.repo.owner,
33
35
  repo: context.repo.repo,
34
36
  title: 'GA4 API changes detected',
35
- body: `${{ steps.diff.outputs.issue_body }}`,
37
+ body: process.env.ISSUE_BODY,
36
38
  labels: ['api-change']
37
39
  });
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: google-analytics-cli
3
- Version: 0.2.2
3
+ Version: 0.2.3
4
4
  Summary: Command-line interface for Google Analytics 4
5
5
  Project-URL: Homepage, https://github.com/daidalytics/google-analytics-cli
6
6
  Project-URL: Repository, https://github.com/daidalytics/google-analytics-cli
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "google-analytics-cli"
3
- version = "0.2.2"
3
+ version = "0.2.3"
4
4
  description = "Command-line interface for Google Analytics 4"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.10"
@@ -0,0 +1,56 @@
1
+ """User-provided data settings commands for a property."""
2
+
3
+ from typing import Optional
4
+
5
+ import typer
6
+
7
+ from ..api.client import get_admin_alpha_client
8
+ from ..config.store import get_effective_value
9
+ from ..utils import handle_error, output, require_options, resolve_output_format
10
+
11
+ user_provided_data_app = typer.Typer(
12
+ name="user-provided-data",
13
+ help="Manage user-provided data settings for a property",
14
+ no_args_is_help=True,
15
+ )
16
+
17
+
18
+ @user_provided_data_app.command("get")
19
+ def get_cmd(
20
+ property_id: Optional[str] = typer.Option(
21
+ None, "--property-id", "-p", help="Property ID (numeric)"
22
+ ),
23
+ output_format: Optional[str] = typer.Option(
24
+ None, "--output", "-o", help="Output format (json, table, compact)"
25
+ ),
26
+ ):
27
+ """Get user-provided data settings for a property."""
28
+ try:
29
+ effective_property = get_effective_value(property_id, "default_property_id")
30
+ require_options({"property_id": effective_property}, ["property_id"])
31
+ effective_format = resolve_output_format(output_format)
32
+
33
+ admin = get_admin_alpha_client()
34
+ settings = (
35
+ admin.properties()
36
+ .getUserProvidedDataSettings(
37
+ name=f"properties/{effective_property}/userProvidedDataSettings"
38
+ )
39
+ .execute()
40
+ )
41
+ output(
42
+ settings,
43
+ effective_format,
44
+ columns=[
45
+ "name",
46
+ "userProvidedDataCollectionEnabled",
47
+ "automaticallyDetectedDataCollectionEnabled",
48
+ ],
49
+ headers=[
50
+ "Resource Name",
51
+ "Data Collection Enabled",
52
+ "Auto-Detection Enabled",
53
+ ],
54
+ )
55
+ except Exception as e:
56
+ handle_error(e)
@@ -30,6 +30,7 @@ from .commands.properties import properties_app
30
30
  from .commands.property_settings import property_settings_app
31
31
  from .commands.reports import reports_app
32
32
  from .commands.upgrade_cmd import upgrade_app
33
+ from .commands.user_provided_data import user_provided_data_app
33
34
 
34
35
  app = typer.Typer(
35
36
  name="ga",
@@ -65,6 +66,7 @@ app.add_typer(property_settings_app, name="property-settings")
65
66
  app.add_typer(reports_app, name="reports")
66
67
  app.add_typer(agent_app, name="agent")
67
68
  app.add_typer(upgrade_app, name="upgrade")
69
+ app.add_typer(user_provided_data_app, name="user-provided-data")
68
70
  app.add_typer(completions_app, name="completions")
69
71
 
70
72
 
@@ -0,0 +1,83 @@
1
+ """Tests for user-provided-data commands (get)."""
2
+
3
+ import re
4
+ from unittest.mock import MagicMock, patch
5
+
6
+ from typer.testing import CliRunner
7
+
8
+ from ga_cli.main import app
9
+
10
+ runner = CliRunner()
11
+
12
+
13
+ def _strip_ansi(text: str) -> str:
14
+ """Remove ANSI escape sequences from text."""
15
+ return re.sub(r"\x1b\[[0-9;]*m", "", text)
16
+
17
+
18
+ SAMPLE_SETTINGS = {
19
+ "name": "properties/111111/userProvidedDataSettings",
20
+ "userProvidedDataCollectionEnabled": True,
21
+ "automaticallyDetectedDataCollectionEnabled": False,
22
+ }
23
+
24
+
25
+ def _mock_admin_alpha_client(settings=None):
26
+ mock_client = MagicMock()
27
+ get_ret = mock_client.properties.return_value.getUserProvidedDataSettings
28
+ get_ret.return_value.execute.return_value = settings or SAMPLE_SETTINGS
29
+ return mock_client
30
+
31
+
32
+ class TestUserProvidedDataGet:
33
+ def test_get_table_output(self):
34
+ mock_client = _mock_admin_alpha_client()
35
+
36
+ with patch(
37
+ "ga_cli.commands.user_provided_data.get_admin_alpha_client",
38
+ return_value=mock_client,
39
+ ):
40
+ result = runner.invoke(
41
+ app, ["user-provided-data", "get", "--property-id", "111111"]
42
+ )
43
+
44
+ assert result.exit_code == 0
45
+ mock_client.properties.return_value.getUserProvidedDataSettings.assert_called_once_with(
46
+ name="properties/111111/userProvidedDataSettings"
47
+ )
48
+
49
+ def test_get_json_output(self):
50
+ mock_client = _mock_admin_alpha_client()
51
+
52
+ with patch(
53
+ "ga_cli.commands.user_provided_data.get_admin_alpha_client",
54
+ return_value=mock_client,
55
+ ):
56
+ result = runner.invoke(
57
+ app, ["user-provided-data", "get", "-p", "111111", "-o", "json"]
58
+ )
59
+
60
+ assert result.exit_code == 0
61
+ assert "userProvidedDataCollectionEnabled" in result.output
62
+
63
+ def test_get_requires_property_id(self):
64
+ result = runner.invoke(app, ["user-provided-data", "get"])
65
+
66
+ assert result.exit_code != 0
67
+ assert "property-id" in _strip_ansi(result.output).lower()
68
+
69
+ def test_get_api_error(self):
70
+ mock_client = MagicMock()
71
+ get_ret = mock_client.properties.return_value.getUserProvidedDataSettings
72
+ get_ret.return_value.execute.side_effect = Exception("Not found")
73
+
74
+ with patch(
75
+ "ga_cli.commands.user_provided_data.get_admin_alpha_client",
76
+ return_value=mock_client,
77
+ ):
78
+ result = runner.invoke(
79
+ app, ["user-provided-data", "get", "-p", "999"]
80
+ )
81
+
82
+ assert result.exit_code == 3
83
+ assert "Not found" in result.output