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: Added properties to Assets stream #15

Merged
merged 1 commit into from
Jan 3, 2024
Merged
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
2 changes: 2 additions & 0 deletions meltano.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,5 @@ plugins:
- name: target-jsonl
variant: andyh1203
pip_url: target-jsonl
config:
destination_path: output/
17 changes: 16 additions & 1 deletion tap_freshservice/streams/assets.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
"""Stream type classes for tap-freshservice."""

from __future__ import annotations
from singer_sdk import typing as th # JSON Schema typing helpers
from typing import Optional
import typing as t
from tap_freshservice.client import FreshserviceStream

class AssetsStream(FreshserviceStream):
name = "assets"
path = "/assets?workspace_id=0"
records_jsonpath="$.assets[*]"

def get_url_params(self, context: dict | None, next_page_token) -> dict[str, t.Any] | str:
parent_params = super().get_url_params(context, next_page_token)
params = {"include": "type_fields"}
params.update(parent_params)
return params

def get_child_context(self, record: dict, context: Optional[dict]) -> dict:
"""Return a context dictionary for the child streams.
Refer to https://sdk.meltano.com/en/latest/parent_streams.html"""
Expand All @@ -34,5 +43,11 @@ def get_child_context(self, record: dict, context: Optional[dict]) -> dict:
th.Property("updated_at", th.DateTimeType),
th.Property("author_type", th.StringType),
th.Property("end_of_life", th.DateTimeType),
th.Property("discovery_enabled", th.BooleanType)
th.Property("discovery_enabled", th.BooleanType),
th.Property("type_fields", th.ObjectType(
th.Property("code_18000842429", th.StringType),
th.Property("category_18000842429", th.StringType),
th.Property("status_18000842429", th.StringType),
th.Property("url_18000842432", th.StringType)
))
).to_dict()