diff --git a/tap_zendesk/schemas/sla_policies.json b/tap_zendesk/schemas/sla_policies.json new file mode 100644 index 0000000..c7e0161 --- /dev/null +++ b/tap_zendesk/schemas/sla_policies.json @@ -0,0 +1,95 @@ +{ + "properties": { + "id": { + "type": [ + "integer" + ] + }, + "url": { + "type": [ + "null", + "string" + ] + }, + "title": { + "type": [ + "null", + "string" + ] + }, + "description": { + "type": [ + "null", + "string" + ] + }, + "position": { + "type": [ + "null", + "integer" + ] + }, + "filter": { + "properties": { + "all": { + "type": ["null", "array"], + "items": { + "properties": { + "field": { "type": ["string"] }, + "operator": { "type": ["string"] }, + "value": { "type": ["string"] } + }, + "type": ["object"] + } + }, + "any": { + "type": ["null", "array"], + "items": { + "properties": { + "field": { "type": ["string"] }, + "operator": { "type": ["string"] }, + "value": { "type": ["string"] } + }, + "type": ["object"] + } + } + }, + "type": ["null", "object"] + }, + "policy_metrics": { + "type": [ + "null", + "array" + ], + "items": { + "properties": { + "priority": { "type": ["null", "string"] }, + "target": { "type": ["null", "integer"] }, + "business_hours": { "type": ["null", "boolean"] }, + "metric": { } + }, + "type": [ + "null", + "object" + ] + } + }, + "created_at": { + "type": [ + "null", + "string" + ], + "format": "date-time" + }, + "updated_at": { + "type": [ + "null", + "string" + ], + "format": "date-time" + } + }, + "type": [ + "object" + ] +} diff --git a/tap_zendesk/streams.py b/tap_zendesk/streams.py index 15dc3ba..255a7de 100644 --- a/tap_zendesk/streams.py +++ b/tap_zendesk/streams.py @@ -412,6 +412,14 @@ def sync(self, state): else: LOGGER.info('Received group_membership record with no id or updated_at, skipping...') +class SLAPolicies(Stream): + name = "sla_policies" + replication_method = "FULL_TABLE" + + def sync(self, state): + for policy in self.client.sla_policies(): + yield (self.stream, policy) + STREAMS = { "tickets": Tickets, "groups": Groups, @@ -425,5 +433,6 @@ def sync(self, state): "macros": Macros, "satisfaction_ratings": SatisfactionRatings, "tags": Tags, - "ticket_metrics": TicketMetrics + "ticket_metrics": TicketMetrics, + "sla_policies": SLAPolicies, }