From c9ecab9872a68332c5dbd026d95bc41c8d4122e9 Mon Sep 17 00:00:00 2001 From: Marton Verhoczki Date: Thu, 22 Aug 2024 15:34:53 +0200 Subject: [PATCH] Modify Users Stream to pull data from new account filtered users endpoint Added new optional configuration for account_id Jira: PHO-6741 --- tap_canvas_catalog/streams.py | 13 ++++++++++++- tap_canvas_catalog/tap.py | 7 +++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/tap_canvas_catalog/streams.py b/tap_canvas_catalog/streams.py index 1384f45..56d4d84 100644 --- a/tap_canvas_catalog/streams.py +++ b/tap_canvas_catalog/streams.py @@ -3,6 +3,7 @@ from __future__ import annotations from pathlib import Path +from typing import Any from singer_sdk import typing as th # JSON Schema typing helpers @@ -10,11 +11,21 @@ class UsersStream(CanvasCatalogStream): name = "users" - path = "/users" + path = "/integrations/hotglue/sources/users" primary_keys = ["id"] records_jsonpath = "$.users[*]" replication_key = "updated_at" + def get_url_params( + self, + context: dict | None, + next_page_token: Any | None, + ) -> dict[str, Any]: + params = super().get_url_params(context, next_page_token) + params["accountId"] = self.config.get("account_id", "") + + return params + schema = th.PropertiesList( th.Property( "id", diff --git a/tap_canvas_catalog/tap.py b/tap_canvas_catalog/tap.py index 9b25e4b..dd15878 100644 --- a/tap_canvas_catalog/tap.py +++ b/tap_canvas_catalog/tap.py @@ -29,6 +29,13 @@ class TapCanvasCatalog(Tap): secret=False, description="The URL for the Canvas Catalog API", ), + th.Property( + "account_id", + th.StringType, + required=False, + secret=False, + description="The sub-account id to pull data from", + ), ).to_dict() def discover_streams(self) -> list[streams.CanvasCatalogStream]: