Skip to content

Commit

Permalink
Added the subscriptions and orders streams
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Dec 9, 2024
1 parent c0c5e79 commit 64ac320
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
48 changes: 48 additions & 0 deletions tap_polarsh/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
}
2 changes: 2 additions & 0 deletions tap_polarsh/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,10 @@
from tap_polarsh.client import PolarStream

STREAMS: t.Sequence[type[PolarStream]] = [
streams.Orders,
streams.Organizations,
streams.Repositories,
streams.Subscriptions,
]


Expand Down

0 comments on commit 64ac320

Please sign in to comment.