diff --git a/tap_polarsh/streams.py b/tap_polarsh/streams.py index 8b1a86a..47648b9 100644 --- a/tap_polarsh/streams.py +++ b/tap_polarsh/streams.py @@ -116,3 +116,51 @@ def get_url_params( **super().get_url_params(context, next_page_token), "organization_id": context["organization_id"] if context else None, } + + +class Subscriptions(PolarStream): + """Subscriptions stream.""" + + name = "subscriptions" + path = "/api/v1/subscriptions" + primary_keys = ("id",) + replication_key = None + + swagger_ref: str = "Subscription" + + parent_stream_type = Organizations + + def get_url_params( + self, + context: Context | None, + next_page_token: t.Any | None, # noqa: ANN401 + ) -> dict[str, t.Any]: + """Get URL query parameters.""" + return { + **super().get_url_params(context, next_page_token), + "organization_id": context["organization_id"] if context else None, + } + + +class Orders(PolarStream): + """Orders stream.""" + + name = "orders" + path = "/api/v1/orders" + primary_keys = ("id",) + replication_key = None + + swagger_ref: str = "Order" + + parent_stream_type = Organizations + + def get_url_params( + self, + context: Context | None, + next_page_token: t.Any | None, # noqa: ANN401 + ) -> dict[str, t.Any]: + """Get URL query parameters.""" + return { + **super().get_url_params(context, next_page_token), + "organization_id": context["organization_id"] if context else None, + } diff --git a/tap_polarsh/tap.py b/tap_polarsh/tap.py index b5d21b5..b77a53a 100644 --- a/tap_polarsh/tap.py +++ b/tap_polarsh/tap.py @@ -16,8 +16,10 @@ from tap_polarsh.client import PolarStream STREAMS: t.Sequence[type[PolarStream]] = [ + streams.Orders, streams.Organizations, streams.Repositories, + streams.Subscriptions, ]