Skip to content

Commit

Permalink
Add users stream
Browse files Browse the repository at this point in the history
  • Loading branch information
wadevries committed Sep 19, 2023
1 parent 9f6a024 commit 3aed919
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 0 deletions.
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

0 comments on commit 3aed919

Please sign in to comment.