From f7a04c2ed96df4dd4090c2086b3d1faf501dd70b Mon Sep 17 00:00:00 2001 From: marcosmarxm Date: Thu, 30 Jun 2022 11:06:40 -0300 Subject: [PATCH 1/4] add next_page_tooken and request --- .../source_zendesk_support/streams.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py index 7f3ece6f653a..0c115b77fc71 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py +++ b/airbyte-integrations/connectors/source-zendesk-support/source_zendesk_support/streams.py @@ -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): """ From 6b12df7369001c2c79bf4664a7c457845dc96c7c Mon Sep 17 00:00:00 2001 From: marcosmarxm Date: Thu, 30 Jun 2022 11:17:07 -0300 Subject: [PATCH 2/4] correct group_membership paginatin --- .../connectors/source-zendesk-support/Dockerfile | 2 +- .../connectors/source-zendesk-support/unit_tests/unit_test.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airbyte-integrations/connectors/source-zendesk-support/Dockerfile b/airbyte-integrations/connectors/source-zendesk-support/Dockerfile index 7525f19db6b2..11188992a806 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/Dockerfile +++ b/airbyte-integrations/connectors/source-zendesk-support/Dockerfile @@ -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 diff --git a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py index 35537455fe54..7e7eb5fb1386 100644 --- a/airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py +++ b/airbyte-integrations/connectors/source-zendesk-support/unit_tests/unit_test.py @@ -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}), From fb89c7baea51ea177b0287b5ae08217a3c6695cf Mon Sep 17 00:00:00 2001 From: marcosmarxm Date: Thu, 30 Jun 2022 14:32:01 -0300 Subject: [PATCH 3/4] update doc --- docs/integrations/sources/zendesk-support.md | 1 + 1 file changed, 1 insertion(+) diff --git a/docs/integrations/sources/zendesk-support.md b/docs/integrations/sources/zendesk-support.md index 0f2bff67a94b..b6dea90fd5df 100644 --- a/docs/integrations/sources/zendesk-support.md +++ b/docs/integrations/sources/zendesk-support.md @@ -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) | From b6de85bce2dcaa903de4f57356b6debd490cdedf Mon Sep 17 00:00:00 2001 From: Octavia Squidington III Date: Thu, 30 Jun 2022 17:56:19 +0000 Subject: [PATCH 4/4] auto-bump connector version --- .../init/src/main/resources/seed/source_definitions.yaml | 2 +- airbyte-config/init/src/main/resources/seed/source_specs.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml index 01639e5eb5ce..53535ccec9cc 100644 --- a/airbyte-config/init/src/main/resources/seed/source_definitions.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_definitions.yaml @@ -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 diff --git a/airbyte-config/init/src/main/resources/seed/source_specs.yaml b/airbyte-config/init/src/main/resources/seed/source_specs.yaml index f930c62778c6..2f86640f3149 100644 --- a/airbyte-config/init/src/main/resources/seed/source_specs.yaml +++ b/airbyte-config/init/src/main/resources/seed/source_specs.yaml @@ -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: