diff --git a/README.md b/README.md index ab41abd..b417fce 100644 --- a/README.md +++ b/README.md @@ -60,6 +60,14 @@ Note that the most up to date information is located in tap_clickup/streams.py. - Bookmark column(s): N/A - Link to API endpoint documentation: [Spaces](https://jsapi.apiary.io/apis/clickup20/reference/0/spaces.html) +### Time Entries +- Table name: time_entries +- Description: All time entries are pulled for every team. Didn't do incremental as we have https://github.com/AutoIDM/tap-clickup/issues/95 open still +- Primary key column(s): id +- Replicated fully or incrementally: No +- Bookmark column(s): N/A +- Link to API endpoint documentation: [Time Entries](https://jsapi.apiary.io/apis/clickup20/reference/0/time-tracking-legacy/get-time-entries-within-a-date-range.html) + ### Folders - Table name: folder - Description: Each space can have multiple folders diff --git a/tap_clickup/schemas/time_entries.json b/tap_clickup/schemas/time_entries.json new file mode 100644 index 0000000..b8b9793 --- /dev/null +++ b/tap_clickup/schemas/time_entries.json @@ -0,0 +1,103 @@ +{ + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "task": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "status": { + "type": "object", + "properties": { + "status": { + "type": "string" + }, + "color": { + "type": "string" + }, + "type": { + "type": "string" + }, + "orderindex": { + "type": "integer" + } + } }, + "custom_type": { + "type": "null" + } + } }, + "wid": { + "type": "string" + }, + "user": { + "type": "object", + "properties": { + "id": { + "type": "integer" + }, + "username": { + "type": "string" + }, + "email": { + "type": "string" + }, + "color": { + "type": "string" + }, + "initials": { + "type": "string" + }, + "profilePicture": { + "type": "null" + } + } }, + "billable": { + "type": "boolean" + }, + "start": { + "type": "string" + }, + "end": { + "type": "string" + }, + "duration": { + "type": "string" + }, + "description": { + "type": "string" + }, + "tags": { + "type": "array" + }, + "source": { + "type": "string" + }, + "at": { + "type": "string" + }, + "task_location": { + "type": "object", + "properties": { + "list_id": { + "type": "string" + }, + "folder_id": { + "type": "string" + }, + "space_id": { + "type": "string" + } + } + }, + "task_url": { + "type": "string" + } + } +} diff --git a/tap_clickup/streams.py b/tap_clickup/streams.py index 85aa0af..5adbef1 100644 --- a/tap_clickup/streams.py +++ b/tap_clickup/streams.py @@ -17,7 +17,6 @@ class TeamsStream(ClickUpStream): path = "/team" primary_keys = ["id"] replication_key = None - # Optionally, you may also use `schema_filepath` in place of `schema`: schema_filepath = SCHEMAS_DIR / "team.json" records_jsonpath = "$.teams[*]" @@ -28,6 +27,18 @@ def get_child_context(self, record: dict, context: Optional[dict]) -> dict: } +class TimeEntries(ClickUpStream): + """Time Entries""" + + name = "time_entries" + path = "/team/{team_id}/time_entries" + primary_keys = ["id"] + replication_key = None + schema_filepath = SCHEMAS_DIR / "time_entries.json" + records_jsonpath = "$.spaces[*]" + parent_stream_type = TeamsStream + + class SpacesStream(ClickUpStream): """Spaces""" @@ -35,7 +46,6 @@ class SpacesStream(ClickUpStream): path = "/team/{team_id}/space" primary_keys = ["id"] replication_key = None - # Optionally, you may also use `schema_filepath` in place of `schema`: schema_filepath = SCHEMAS_DIR / "space.json" records_jsonpath = "$.spaces[*]" parent_stream_type = TeamsStream diff --git a/tap_clickup/tap.py b/tap_clickup/tap.py index 6ac48b0..6fefd61 100644 --- a/tap_clickup/tap.py +++ b/tap_clickup/tap.py @@ -18,6 +18,7 @@ TasksStream, FolderCustomFieldsStream, FolderlessCustomFieldsStream, + TimeEntries, ) STREAM_TYPES = [ @@ -33,6 +34,7 @@ TasksStream, FolderCustomFieldsStream, FolderlessCustomFieldsStream, + TimeEntries, ]