From 272ac144b7e929695e02c48d1cb84152801537c1 Mon Sep 17 00:00:00 2001 From: Rodrigo Leite Date: Fri, 10 Sep 2021 11:57:12 +0100 Subject: [PATCH] Zendesk Articles --- setup.py | 2 +- tap_zendesk/schemas/articles.json | 164 ++++++++++++++++++++++++++++++ tap_zendesk/streams.py | 17 +++- 3 files changed, 181 insertions(+), 2 deletions(-) create mode 100644 tap_zendesk/schemas/articles.json diff --git a/setup.py b/setup.py index c4e69b7..5abc053 100644 --- a/setup.py +++ b/setup.py @@ -4,7 +4,7 @@ setup( name='twilio-tap-zendesk', - version='1.0.6', + version='1.0.7', description='Singer.io tap for extracting data from the Zendesk API', author='Twilio', url='https://github.com/twilio-labs/twilio-tap-zendesk', diff --git a/tap_zendesk/schemas/articles.json b/tap_zendesk/schemas/articles.json new file mode 100644 index 0000000..5bd2c06 --- /dev/null +++ b/tap_zendesk/schemas/articles.json @@ -0,0 +1,164 @@ +{ + "type": [ + "null", + "object" + ], + "properties": { + "id": { + "type": [ + "null", + "integer" + ] + }, + "url": { + "type": [ + "null", + "string" + ] + }, + "html_url": { + "type": [ + "null", + "string" + ] + }, + "author_id": { + "type": [ + "null", + "integer" + ] + }, + "comments_disabled": { + "type": [ + "null", + "boolean" + ] + }, + "draft": { + "type": [ + "null", + "boolean" + ] + }, + "promoted": { + "type": [ + "null", + "boolean" + ] + }, + "position": { + "type": [ + "null", + "integer" + ] + }, + "vote_sum": { + "type": [ + "null", + "integer" + ] + }, + "vote_count": { + "type": [ + "null", + "integer" + ] + }, + "section_id": { + "type": [ + "null", + "integer" + ] + }, + "created_at": { + "type": [ + "null", + "string" + ] + }, + "updated_at": { + "type": [ + "null", + "string" + ] + }, + "name": { + "type": [ + "null", + "string" + ] + }, + "title": { + "type": [ + "null", + "string" + ] + }, + "source_locale": { + "type": [ + "null", + "string" + ] + }, + "locale": { + "type": [ + "null", + "string" + ] + }, + "outdated": { + "type": [ + "null", + "boolean" + ] + }, + "outdated_locales": { + "type": [ + "null", + "array" + ], + "items": { + "type": [ + "null", + "string" + ] + } + }, + "edited_at": { + "type": [ + "null", + "string" + ] + }, + "user_segment_id": { + "type": [ + "null", + "integer" + ] + }, + "permission_group_id": { + "type": [ + "null", + "integer" + ] + }, + "label_names": { + "type": [ + "null", + "array" + ], + "items": { + "type": [ + "null", + "string" + ] + } + } + }, + "body": { + "type": [ + "null", + "string" + ] + } +} \ No newline at end of file diff --git a/tap_zendesk/streams.py b/tap_zendesk/streams.py index 1305f02..d7b5e15 100644 --- a/tap_zendesk/streams.py +++ b/tap_zendesk/streams.py @@ -585,6 +585,20 @@ def sync(self, state): # pylint: disable=unused-argument page = page + 1 agents_activity = self.client.talk.agents_activity(page=page) +class Article(Stream): + name = "articles" + replication_method = "INCREMENTAL" + replication_key = "updated_at" + + def sync(self, state): + bookmark = self.get_bookmark(state) + articles = self.client.help_center.articles.incremental(start_time=bookmark) + for article in articles: + if check_end_date(article, self.config, self.replication_key): + break + + yield self.stream, article + STREAMS = { "tickets": Tickets, "groups": Groups, @@ -601,5 +615,6 @@ def sync(self, state): # pylint: disable=unused-argument "ticket_metrics": TicketMetrics, "sla_policies": SLAPolicies, "ticket_metric_events": TicketMetricEvents, - "agents_activity": AgentsActivity + "agents_activity": AgentsActivity, + "articles": Article }