Skip to content

Commit

Permalink
Merge pull request #10 from Gunisalvo/articles-api
Browse files Browse the repository at this point in the history
Zendesk Articles
  • Loading branch information
guptaa3 authored Sep 10, 2021
2 parents 864ac94 + 272ac14 commit 17b464e
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 2 deletions.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
164 changes: 164 additions & 0 deletions tap_zendesk/schemas/articles.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
}
17 changes: 16 additions & 1 deletion tap_zendesk/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -586,6 +586,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,
Expand All @@ -602,5 +616,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
}

0 comments on commit 17b464e

Please sign in to comment.