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

feat: Implement the subusers stream #262

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
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
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),
]
Loading