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

Add users stream #7

Merged
merged 1 commit into from
Sep 20, 2023
Merged
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
45 changes: 45 additions & 0 deletions tap_linear/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -298,3 +298,48 @@ class CommentStream(LinearStream):
}
}
"""


class UsersStream(LinearStream):
"""Users stream."""

name = "users"
schema = th.PropertiesList(
th.Property("id", th.StringType),
th.Property("active", th.BooleanType),
th.Property("createdAt", th.DateTimeType),
th.Property("updatedAt", th.DateTimeType),
th.Property("displayName", th.StringType),
th.Property("email", th.StringType),
th.Property("guest", th.BooleanType),
th.Property("lastSeen", th.DateTimeType),
th.Property("name", th.StringType),
).to_dict()

primary_keys: t.ClassVar[list[str]] = ["id"]
replication_key = "updatedAt"
query = """
query Users($next: String, $replicationKeyValue: DateTime) {
users(
first: 100
after: $next
filter: { updatedAt: { gt: $replicationKeyValue } }
) {
nodes {
id
active
createdAt
updatedAt
displayName
email
guest
lastSeen
name
}
pageInfo {
hasNextPage
endCursor
}
}
}
"""
1 change: 1 addition & 0 deletions tap_linear/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ def discover_streams(self) -> list[streams.LinearStream]:
streams.CyclesStream(self),
streams.IssuesStream(self),
streams.CommentStream(self),
streams.UsersStream(self),
]


Expand Down