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

TDL-19802: Add new streams talk_phone_numbers and ticket_metrics_event #111

Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
29 commits
Select commit Hold shift + click to select a range
cb00f78
TDL-19802: Add new streams talk_phone_numbers and ticket_metrics_event
Jul 6, 2022
ee7757b
resolevd pylint error
Jul 6, 2022
e1ea545
add unittest
Jul 6, 2022
9e7f32b
add unitests for both newly added streams
Jul 6, 2022
c857c54
add streams in base.py
Jul 12, 2022
8237c8c
remove exception
Jul 12, 2022
e3eee87
exclude ola field from test_all_field test case
Jul 13, 2022
cedef29
remove token field from talk_pjone_numbers all field test case
Jul 13, 2022
3ac2435
updated start_date in base.py
Jul 15, 2022
1c0823d
Merge branch 'master' into TDL-19802-Add-New-Streams-talk_phone_numbe…
kethan1122 May 30, 2023
6c5878a
ignore talk_phone_numbers for bookmark test
kethan1122 May 30, 2023
a914fff
add new fields
kethan1122 May 30, 2023
7876418
change start date
kethan1122 May 30, 2023
43eb857
change start date
kethan1122 May 30, 2023
b4a3c68
add backoff for connectionReseterror and chunkencoding error
kethan1122 May 30, 2023
7a2c2c9
add backoff for connectionReseterror and chunkencoding error
kethan1122 May 30, 2023
647a698
add backoff for connectionReseterror and Protocol error
kethan1122 May 30, 2023
e085317
connection reset error
kethan1122 May 30, 2023
2e23cfd
remove backoffs
kethan1122 May 31, 2023
45c705a
revert http changes and all fields test
kethan1122 Jun 5, 2023
12e39ce
revert http changes
kethan1122 Jun 5, 2023
8da00ec
revert http changes
kethan1122 Jun 5, 2023
c19e945
use builtin libraries
kethan1122 Jun 6, 2023
58fa697
Merge branch 'master' into TDL-19802-Add-New-Streams-talk_phone_numbe…
kethan1122 Jun 12, 2023
b1ef01b
merge with master
kethan1122 Jun 12, 2023
927a63d
adjust integration tests
kethan1122 Jun 12, 2023
f3718a7
adjust pagination test
kethan1122 Jun 13, 2023
3cb213d
make time as date-time format
kethan1122 Jun 13, 2023
bb10871
chnagelog and version bump
kethan1122 Jun 14, 2023
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
207 changes: 207 additions & 0 deletions tap_zendesk/schemas/talk_phone_numbers.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,207 @@
{
"type": [
"null",
"object"
],
"properties": {
"capabilities": {
"type": [
"null",
"object"
],
"properties": {
"sms": {
"type": [
"null",
"boolean"
]
},
"mms": {
"type": [
"null",
"boolean"
]
},
"voice": {
"type": [
"null",
"boolean"
]
}
}
},
"categorised_greetings": {
"properties": { },
"type": [
"null",
"object"
]
},
"categorised_greetings_with_sub_settings": {
"properties": { },
"type": [
"null",
"object"
]
},
"country_code": {
"type": [
"null",
"string"
]
},
"created_at": {
"type": [
"null",
"string"
],
"format": "date-time"
},
"default_greeting_ids": {
"type": ["null", "array"],
"items": {
"type": [
"null",
"string"
]
}
},
"default_group_id": {
"type": [
"null",
"integer"
]
},
"display_number": {
"type": [
"null",
"string"
]
},
"external": {
"type": [
"null",
"boolean"
]
},
"greeting_ids": {
"type": ["null", "array"],
"items": {
"type": [
"null",
"integer"
]
}
},
"group_ids": {
"type": ["null", "array"],
"items": {
"type": [
"null",
"integer"
]
}
},
"id": {
"type": [
"integer"
]
},
"ivr_id": {
"type": [
"null",
"integer"
]
},
"line_type": {
"type": [
"null",
"string"
]
},
"location": {
"type": [
"null",
"string"
]
},
"name": {
"type": [
"null",
"string"
]
},
"nickname": {
"type": [
"null",
"string"
]
},
"number": {
"type": [
"null",
"string"
]
},
"outbound_enabled": {
"type": [
"null",
"boolean"
]
},
"priority": {
"type": [
"null",
"integer"
]
},
"recorded": {
"type": [
"null",
"boolean"
]
},
"schedule_id": {
"type": [
"null",
"integer"
]
},
"sms_enabled": {
"type": [
"null",
"boolean"
]
},
"sms_group_id": {
"type": [
"null",
"integer"
]
},
"token": {
"type": [
"null",
"string"
]
},
"toll_free": {
"type": [
"null",
"boolean"
]
},
"transcription": {
"type": [
"null",
"boolean"
]
},
"voice_enabled": {
"type": [
"null",
"boolean"
]
}
}
}
115 changes: 115 additions & 0 deletions tap_zendesk/schemas/ticket_metric_events.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,115 @@
{
"type": [
"null",
"object"
],
"properties": {
"id": {
"type": [
"integer"
]
},
"instance_id": {
"type": [
"null",
"integer"
]
},
"metric": {
"type": [
"null",
"string"
]
},
"ticket_id": {
"type": [
"null",
"integer"
]
},
"time": {
"type": [
"null",
"string"
]
},
"type": {
"type": [
"null",
"string"
]
},
"sla": {
"type": [
"null",
"object"
],
"properties": {
"target": {
"type": [
"null",
"integer"
]
},
"business_hours": {
"type": [
"null",
"boolean"
]
},
"policy": {
"type": [
"null",
"object"
],
"properties": {
"id": {
"type": [
"null",
"integer"
]
},
"title": {
"type": [
"null",
"string"
]
},
"description": {
"type": [
"null",
"string"
]
}
}
}
}
},
"status": {
"type": [
"null",
"object"
],
"properties": {
"calendar": {
"type": [
"null",
"integer"
]
},
"business": {
"type": [
"null",
"integer"
]
}
}
},
"deleted": {
"type": [
"null",
"boolean"
]
}
}
}
45 changes: 45 additions & 0 deletions tap_zendesk/streams.py
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,34 @@ def check_access(self):
#Skip 404 ZendeskNotFoundError error as goal is just to check whether TicketComments have read permission or not
pass

class TicketMetricEvents(Stream):
name = "ticket_metric_events"
replication_method = "INCREMENTAL"
replication_key = "time"
count = 0

def sync(self, state):
bookmark = self.get_bookmark(state)
start = bookmark - datetime.timedelta(seconds=1)

epoch_start = int(start.strftime('%s'))
parsed_start = singer.strftime(start, "%Y-%m-%dT%H:%M:%SZ")
ticket_metric_events = self.client.tickets.metrics_incremental(start_time=epoch_start)
for event in ticket_metric_events:
self.count += 1
if bookmark < utils.strptime_with_tz(event.time):
self.update_bookmark(state, event.time)
if parsed_start <= event.time:
yield (self.stream, event)

def check_access(self):
try:
epoch_start = int(utils.now().strftime('%s'))
self.client.tickets.metrics_incremental(start_time=epoch_start)
except http.ZendeskNotFoundError:
#Skip 404 ZendeskNotFoundError error as goal is just to check whether TicketComments have read permission or not
pass

class TicketComments(Stream):
name = "ticket_comments"
replication_method = "INCREMENTAL"
Expand Down Expand Up @@ -440,6 +468,21 @@ def check_access(self):
#Skip 404 ZendeskNotFoundError error as goal is to just check to whether TicketComments have read permission or not
pass

class TalkPhoneNumbers(Stream):
name = 'talk_phone_numbers'
replication_method = "FULL_TABLE"

def sync(self, state): # pylint: disable=unused-argument
for phone_number in self.client.talk.phone_numbers():
yield (self.stream, phone_number)

def check_access(self):
try:
self.client.talk.phone_numbers()
except http.ZendeskNotFoundError:
#Skip 404 ZendeskNotFoundError error as goal is to just check to whether TicketComments have read permission or not
pass

class SatisfactionRatings(CursorBasedStream):
name = "satisfaction_ratings"
replication_method = "INCREMENTAL"
Expand Down Expand Up @@ -608,5 +651,7 @@ def check_access(self):
"satisfaction_ratings": SatisfactionRatings,
"tags": Tags,
"ticket_metrics": TicketMetrics,
"ticket_metric_events": TicketMetricEvents,
"sla_policies": SLAPolicies,
"talk_phone_numbers": TalkPhoneNumbers,
}
Loading