Skip to content

Commit

Permalink
feat: Added Asset stream
Browse files Browse the repository at this point in the history
  • Loading branch information
cmarche2ti committed Nov 2, 2023
1 parent b4722b9 commit 99ed63f
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 1 deletion.
4 changes: 4 additions & 0 deletions config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"api_key": "oB66sdLxJI1FMCZygouX",
"url_base": "https://datateer.freshservice.com/api/v2"
}
39 changes: 39 additions & 0 deletions tap_freshservice/streams/assets.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
"""Stream type classes for tap-freshservice."""
from singer_sdk import typing as th # JSON Schema typing helpers

from tap_freshservice.client import FreshserviceStream

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

def get_url(self, context: dict):
url = super().get_url(context)
return url

def build_prepared_request(self, *args, **kwargs):
req = super().build_prepared_request(*args, **kwargs)
return req

schema = th.PropertiesList(
th.Property("id", th.IntegerType),
th.Property("display_id", th.IntegerType),
th.Property("name", th.StringType),
th.Property("description", th.StringType),
th.Property("asset_type_id", th.IntegerType),
th.Property("impact", th.StringType),
th.Property("usage_type", th.StringType),
th.Property("asset_tag", th.StringType),
th.Property("user_id", th.IntegerType),
th.Property("department_id", th.IntegerType),
th.Property("location_id", th.IntegerType),
th.Property("agent_id", th.IntegerType),
th.Property("group_id", th.IntegerType),
th.Property("assigned_on", th.DateTimeType),
th.Property("created_at", th.DateTimeType),
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)
).to_dict()
3 changes: 2 additions & 1 deletion tap_freshservice/tap.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from singer_sdk import Tap
from singer_sdk import typing as th # JSON schema typing helpers

from tap_freshservice.streams import (groups, tickets)
from tap_freshservice.streams import (assets, groups, tickets)


class TapFreshservice(Tap):
Expand Down Expand Up @@ -45,6 +45,7 @@ def discover_streams(self) -> list[tickets.FreshserviceStream]:
return [
tickets.TicketsStream(self),
groups.GroupsStream(self),
assets.AssetsStream(self),
]


Expand Down

0 comments on commit 99ed63f

Please sign in to comment.