Skip to content

Commit

Permalink
Merge pull request #15 from Datateer/type-fields
Browse files Browse the repository at this point in the history
feat: Added properties to Assets stream
  • Loading branch information
cmarche2ti authored Jan 3, 2024
2 parents 09fa1a9 + a948ac5 commit 59689c2
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 1 deletion.
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()

0 comments on commit 59689c2

Please sign in to comment.