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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Source Zendesk Support: pagination group membership #14304

Merged
Merged
Show file tree
Hide file tree
Changes from 2 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
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