Skip to content

Commit

Permalink
Fix: Bug on params for issues
Browse files Browse the repository at this point in the history
  • Loading branch information
lordsarcastic committed Oct 7, 2024
1 parent ebe15f9 commit c74edb7
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 4 deletions.
2 changes: 0 additions & 2 deletions integrations/jira/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
from port_ocean.context.ocean import ocean
from port_ocean.utils import http_async_client


PAGE_SIZE = 50
WEBHOOK_NAME = "Port-Ocean-Events-Webhook"
REQUEST_TIMEOUT = 120
Expand Down Expand Up @@ -102,7 +101,6 @@ async def get_all_issues(
self,
params: dict[str, Any] = {},
) -> AsyncGenerator[list[dict[str, Any]], None]:

async for issues in self._make_paginated_request(
f"{self.detail_base_url}/search",
params=params,
Expand Down
4 changes: 4 additions & 0 deletions integrations/jira/integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ class JiraIssueSelector(Selector):
jql: str | None = Field(
description="Jira Query Language (JQL) query to filter issues",
)
fields: str | None = Field(
description="Additional fields to be included in the API response",
default="*all",
)


class JiraIssueResourceConfig(ResourceConfig):
Expand Down
11 changes: 9 additions & 2 deletions integrations/jira/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,15 @@ async def on_resync_projects(kind: str) -> ASYNC_GENERATOR_RESYNC_TYPE:
@ocean.on_resync(ObjectKind.ISSUE)
async def on_resync_issues(kind: str) -> ASYNC_GENERATOR_RESYNC_TYPE:
client = initialize_client()
config = typing.cast(JiraIssueResourceConfig, event.resource_config)
async for issues in client.get_all_issues(config):
config = typing.cast(JiraIssueResourceConfig, event.resource_config).selector
params = {}
if config.jql:
params["jql"] = config.jql

if config.fields:
params["fields"] = config.fields

async for issues in client.get_all_issues(params):
logger.info(f"Received issue batch with {len(issues)} issues")
yield issues

Expand Down

0 comments on commit c74edb7

Please sign in to comment.