Skip to content

Commit

Permalink
fix: fixes query params
Browse files Browse the repository at this point in the history
  • Loading branch information
a-rampalli committed Jul 18, 2023
1 parent 14fee92 commit b0eeb00
Showing 1 changed file with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,7 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str,
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"}
params = {"page": 1, "per_page": self.page_size, "sort_by": self.cursor_field, "sort_order": "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:
Expand All @@ -743,8 +743,6 @@ def request_params(
class Views(SourceZendeskSupportCursorPaginationStream):
"""Views stream: https://developer.zendesk.com/api-reference/ticketing/business-rules/views/#list-views"""

cursor_field = "created_at"

def next_page_token(self, response: requests.Response) -> Optional[Mapping[str, Any]]:
if self._ignore_pagination:
return None
Expand All @@ -754,7 +752,7 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str,
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"}
params = {"page": 1, "per_page": self.page_size, "sort_by": self.cursor_field, "sort_order": "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:
Expand All @@ -773,7 +771,7 @@ def next_page_token(self, response: requests.Response) -> Optional[Mapping[str,
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"}
params = {"page": 1, "per_page": self.page_size, "sort_by": self.cursor_field, "sort_order": "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:
Expand Down

0 comments on commit b0eeb00

Please sign in to comment.