diff --git a/tap_github/repository_streams.py b/tap_github/repository_streams.py index e8a57ec8..f61065aa 100644 --- a/tap_github/repository_streams.py +++ b/tap_github/repository_streams.py @@ -1672,6 +1672,49 @@ class ReviewCommentsStream(GitHubRestStream): th.Property("side", th.StringType), ).to_dict() + def get_child_context(self, record: dict, context: Context | None) -> dict: + return { + "org": context["org"] if context else None, + "repo": context["repo"] if context else None, + "repo_id": context["repo_id"] if context else None, + "comment_id": record["id"] if context else None, + "comment_url": record["html_url"] if context else None, + } + + +class ReviewCommentReactionsStream(GitHubRestStream): + name = "review_comment_reactions" + path = "/repos/{org}/{repo}/pulls/comments/{comment_id}/reactions" + primary_keys: ClassVar[list[str]] = ["id"] + replication_key = "created_at" + parent_stream_type = ReviewCommentsStream + ignore_parent_replication_key = False + state_partitioning_keys: ClassVar[list[str]] = ["repo", "org"] + + def post_process(self, row: dict, context: Context | None = None) -> dict: + row = super().post_process(row, context) + + if context: + row["comment_id"] = context.get("comment_id") + row["comment_url"] = context.get("comment_url") + + return row + + schema = th.PropertiesList( + # Parent keys + th.Property("org", th.StringType), + th.Property("repo", th.StringType), + th.Property("repo_id", th.IntegerType), + th.Property("comment_id", th.IntegerType), + th.Property("comment_url", th.StringType), + # Reaction properties + th.Property("id", th.IntegerType), + th.Property("node_id", th.StringType), + th.Property("user", user_object), + th.Property("content", th.StringType), + th.Property("created_at", th.DateTimeType), + ).to_dict() + class ContributorsStream(GitHubRestStream): """Defines 'Contributors' stream. Fetching User & Bot contributors.""" diff --git a/tap_github/streams.py b/tap_github/streams.py index bda8f74d..ed004630 100644 --- a/tap_github/streams.py +++ b/tap_github/streams.py @@ -48,6 +48,7 @@ ReadmeStream, ReleasesStream, RepositoryStream, + ReviewCommentReactionsStream, ReviewCommentsStream, ReviewsStream, StargazersGraphqlStream, @@ -116,6 +117,7 @@ def __init__(self, valid_queries: set[str], streams: list[type[Stream]]) -> None ReleasesStream, ExtraMetricsStream, RepositoryStream, + ReviewCommentReactionsStream, ReviewCommentsStream, ReviewsStream, StargazersGraphqlStream,