Skip to content

Commit

Permalink
Source Zendesk Support: pagination group membership (#14304)
Browse files Browse the repository at this point in the history
* add next_page_tooken and request

* correct group_membership paginatin

* update doc

* auto-bump connector version

Co-authored-by: Octavia Squidington III <[email protected]>
  • Loading branch information
marcosmarxm and octavia-squidington-iii authored Jun 30, 2022
1 parent cfbbec1 commit dd4079f
Show file tree
Hide file tree
Showing 6 changed files with 19 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1041,7 +1041,7 @@
- name: Zendesk Support
sourceDefinitionId: 79c1aa37-dae3-42ae-b333-d1c105477715
dockerRepository: airbyte/source-zendesk-support
dockerImageTag: 0.2.11
dockerImageTag: 0.2.12
documentationUrl: https://docs.airbyte.io/integrations/sources/zendesk-support
icon: zendesk.svg
sourceType: api
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9859,7 +9859,7 @@
path_in_connector_config:
- "credentials"
- "client_secret"
- dockerImage: "airbyte/source-zendesk-support:0.2.11"
- dockerImage: "airbyte/source-zendesk-support:0.2.12"
spec:
documentationUrl: "https://docs.airbyte.io/integrations/sources/zendesk-support"
connectionSpecification:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,5 +25,5 @@ COPY source_zendesk_support ./source_zendesk_support
ENV AIRBYTE_ENTRYPOINT "python /airbyte/integration_code/main.py"
ENTRYPOINT ["python", "/airbyte/integration_code/main.py"]

LABEL io.airbyte.version=0.2.11
LABEL io.airbyte.version=0.2.12
LABEL io.airbyte.name=airbyte/source-zendesk-support
Original file line number Diff line number Diff line change
Expand Up @@ -493,6 +493,20 @@ class Groups(SourceZendeskSupportStream):
class GroupMemberships(SourceZendeskSupportCursorPaginationStream):
"""GroupMemberships stream: https://developer.zendesk.com/api-reference/ticketing/groups/group_memberships/"""

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
next_page = self._parse_next_page_number(response)
return next_page if next_page else None

def request_params(
self, stream_state: Mapping[str, Any] = None, next_page_token: Mapping[str, Any] = None, **kwargs
) -> MutableMapping[str, Any]:
params = {"page": 1, "per_page": self.page_size, "sort_by": "asc"}
start_time = self.str2unixtime((stream_state or {}).get(self.cursor_field))
params["start_time"] = start_time if start_time else self.str2unixtime(self._start_date)
if next_page_token:
params["page"] = next_page_token
return params


class SatisfactionRatings(SourceZendeskSupportCursorPaginationStream):
"""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ def test_check_stream_state(self, stream_cls, expected):
@pytest.mark.parametrize(
"stream_cls, expected",
[
(GroupMemberships, {"start_time": 1622505600}),
(GroupMemberships, {"page": 1, "per_page": 100, "sort_by": "asc", "start_time": 1622505600}),
(TicketForms, {"start_time": 1622505600}),
(TicketMetricEvents, {"start_time": 1622505600}),
(TicketAudits, {"sort_by": "created_at", "sort_order": "desc", "limit": 1000}),
Expand Down
1 change: 1 addition & 0 deletions docs/integrations/sources/zendesk-support.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ The Zendesk connector ideally should not run into Zendesk API limitations under

| Version | Date | Pull Request | Subject |
|:---------|:-----------|:---------------------------------------------------------|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `0.2.12` | 2022-06-30 | [14304](https://github.com/airbytehq/airbyte/pull/14304) | Fixed Pagination for Group Membership stream|
| `0.2.11` | 2022-06-24 | [14112](https://github.com/airbytehq/airbyte/pull/14112) | Fixed "Retry-After" non integer value |
| `0.2.10` | 2022-06-14 | [13757](https://github.com/airbytehq/airbyte/pull/13757) | Fixed the bug with `TicketMetrics` stream, HTTP Error 429, caused by lots of API requests |
| `0.2.9` | 2022-05-27 | [13261](https://github.com/airbytehq/airbyte/pull/13261) | Bugfix for the unhandled [ChunkedEncodingError](https://github.com/airbytehq/airbyte/issues/12591) and [ConnectionError](https://github.com/airbytehq/airbyte/issues/12155) |
Expand Down

0 comments on commit dd4079f

Please sign in to comment.