Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add SLA Policy stream #21

Merged
merged 2 commits into from
Oct 16, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
95 changes: 95 additions & 0 deletions tap_zendesk/schemas/sla_policies.json
Original file line number Diff line number Diff line change
@@ -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"
]
}
11 changes: 10 additions & 1 deletion tap_zendesk/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -425,5 +433,6 @@ def sync(self, state):
"macros": Macros,
"satisfaction_ratings": SatisfactionRatings,
"tags": Tags,
"ticket_metrics": TicketMetrics
"ticket_metrics": TicketMetrics,
"sla_policies": SLAPolicies,
}