Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: create CustomPropertiesStream class #268

Open
wants to merge 16 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions tap_github/repository_streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -2441,3 +2441,25 @@ class TrafficPageViewsStream(TrafficRestStream):
th.Property("count", th.IntegerType),
th.Property("uniques", th.IntegerType),
).to_dict()


class CustomPropertiesStream(GitHubRestStream):
"""Defines 'custom_properties' stream."""

name = "custom_properties"
path = "/repos/{org}/{repo}/properties/values"
primary_keys = ["repo", "org", "property_name"]
replication_key = None
parent_stream_type = RepositoryStream
ignore_parent_replication_key = True
state_partitioning_keys = ["repo", "org"]

schema = th.PropertiesList(
# Parent Keys
th.Property("repo", th.StringType),
th.Property("org", th.StringType),
th.Property("repo_id", th.IntegerType),
# Custom Property Keys
th.Property("property_name", th.StringType),
th.Property("value", th.StringType),
).to_dict()
10 changes: 9 additions & 1 deletion tap_github/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
CommitsStream,
CommunityProfileStream,
ContributorsStream,
CustomPropertiesStream,
DependenciesStream,
DependentsStream,
EventsStream,
Expand Down Expand Up @@ -74,6 +75,7 @@ def __init__(self, valid_queries: Set[str], streams: List[Type[Stream]]):
CommitsStream,
CommunityProfileStream,
ContributorsStream,
CustomPropertiesStream,
DependenciesStream,
DependentsStream,
EventsStream,
Expand Down Expand Up @@ -117,7 +119,13 @@ def __init__(self, valid_queries: Set[str], streams: List[Type[Stream]]):
)
ORGANIZATIONS = (
{"organizations"},
[OrganizationStream, TeamMembersStream, TeamRolesStream, TeamsStream],
[
CustomPropertiesStream,
OrganizationStream,
TeamMembersStream,
TeamRolesStream,
TeamsStream,
],
)

@classmethod
Expand Down
Loading