Skip to content

Commit

Permalink
Merge pull request #110 from AutoIDM/98-time-entries
Browse files Browse the repository at this point in the history
Added time entries stream
  • Loading branch information
visch authored Mar 3, 2022
2 parents 6452c25 + 80a669f commit 69a11fd
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 2 deletions.
8 changes: 8 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
103 changes: 103 additions & 0 deletions tap_clickup/schemas/time_entries.json
Original file line number Diff line number Diff line change
@@ -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"
}
}
}
14 changes: 12 additions & 2 deletions tap_clickup/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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[*]"

Expand All @@ -28,14 +27,25 @@ 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"""

name = "space"
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
Expand Down
2 changes: 2 additions & 0 deletions tap_clickup/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
TasksStream,
FolderCustomFieldsStream,
FolderlessCustomFieldsStream,
TimeEntries,
)

STREAM_TYPES = [
Expand All @@ -33,6 +34,7 @@
TasksStream,
FolderCustomFieldsStream,
FolderlessCustomFieldsStream,
TimeEntries,
]


Expand Down

0 comments on commit 69a11fd

Please sign in to comment.