Skip to content

Commit

Permalink
feat: Implement the subusers stream
Browse files Browse the repository at this point in the history
  • Loading branch information
edgarrmondragon committed Jul 10, 2024
1 parent 4ab7815 commit d4e5d32
Show file tree
Hide file tree
Showing 3 changed files with 49 additions and 18 deletions.
37 changes: 19 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,29 +29,30 @@ Singer Tap for Jotform. Built with the [Meltano Singer SDK](https://sdk.meltano.

## Settings

| Setting | Required | Default | Description |
|:--------------------|:--------:|:-------:|:------------|
| api_key | True | None | Authentication key. See https://api.jotform.com/docs/#authentication |
| api_url | False | https://api.jotform.com | API Base URL |
| user_agent | False | tap-jotform/0.0.1 | User-Agent header |
| start_date | False | None | Start date for data collection |
| requests_cache | False | None | Cache configuration for HTTP requests |
| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
| stream_map_config | False | None | User-defined config values to be used within map expressions. |
| flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. |
| flattening_max_depth| False | None | The max depth to flatten schemas. |
| Setting | Required | Default | Description |
| :------------------- | :------- | :---------------------- | :------------------------------------------------------------------------------------------------------------------------------------------ |
| api_key | True | None | Authentication key. See https://api.jotform.com/docs/#authentication |
| api_url | False | https://api.jotform.com | API Base URL |
| user_agent | False | tap-jotform/0.0.1 | User-Agent header |
| start_date | False | None | Start date for data collection |
| requests_cache | False | None | Cache configuration for HTTP requests |
| stream_maps | False | None | Config object for stream maps capability. For more information check out [Stream Maps](https://sdk.meltano.com/en/latest/stream_maps.html). |
| stream_map_config | False | None | User-defined config values to be used within map expressions. |
| flattening_enabled | False | None | 'True' to enable schema flattening and automatically expand nested properties. |
| flattening_max_depth | False | None | The max depth to flatten schemas. |

A full list of supported settings and capabilities is available by running: `tap-jotform --about`

## Streams

| Stream name | API endpoint | API docs | Notes |
| :---------- | :---------------- | :--------------------------------------------- | :---- |
| forms | /user/forms | https://api.jotform.com/docs/#user-forms | Replication for this stream is opt-in. See instructions [below](#configuring-incremental-replication). |
| questions | /form/{form_id}/questions | https://api.jotform.com/docs/#form-id-questions | |
| submissions | /user/submissions | https://api.jotform.com/docs/#user-submissions | Replication for this stream is opt-in. See instructions [below](#configuring-incremental-replication). |
| reports | /user/reports | https://api.jotform.com/docs/#user-reports | |
| user_history | /user/history | https://api.jotform.com/docs/#user-history | |
| Stream name | API endpoint | API docs | Notes |
| :----------- | :------------------------ | :---------------------------------------------- | :----------------------------------------------------------------------------------------------------- |
| forms | /user/forms | https://api.jotform.com/docs/#user-forms | Replication for this stream is opt-in. See instructions [below](#configuring-incremental-replication). |
| questions | /form/{form_id}/questions | https://api.jotform.com/docs/#form-id-questions | |
| submissions | /user/submissions | https://api.jotform.com/docs/#user-submissions | Replication for this stream is opt-in. See instructions [below](#configuring-incremental-replication). |
| reports | /user/reports | https://api.jotform.com/docs/#user-reports | |
| user_history | /user/history | https://api.jotform.com/docs/#user-history | |
| subusers | /user/history | https://api.jotform.com/docs/#user-subusers | Requires an Enterprise account |


### Configuring incremental replication
Expand Down
29 changes: 29 additions & 0 deletions tap_jotform/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -363,3 +363,32 @@ def post_process(self, row: dict, context: dict | None = None) -> dict:
}
row["forms"] = forms
return row


class SubusersStream(JotformStream):
"""Subusers stream."""

name = "subusers"
path = "/user/subusers"
primary_keys = ("username",)

selected_by_default = False

schema = th.PropertiesList(
th.Property("owner", th.StringType),
th.Property("status", th.StringType),
th.Property("email", th.EmailType),
th.Property("username", th.StringType),
CREATED_AT,
th.Property(
"permissions",
th.ArrayType(
th.ObjectType(
th.Property("type", th.StringType),
th.Property("resource_id", th.StringType),
th.Property("access_type", th.StringType),
th.Property("title", th.StringType),
),
),
),
).to_dict()
1 change: 1 addition & 0 deletions tap_jotform/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,4 +95,5 @@ def discover_streams(self) -> list[Stream]:
streams.ReportsStream(self),
streams.UserHistory(self),
streams.FoldersStream(self),
streams.SubusersStream(self),
]

0 comments on commit d4e5d32

Please sign in to comment.