Skip to content

Commit

Permalink
fix: add remoteRepoUrl from target (#189)
Browse files Browse the repository at this point in the history
  • Loading branch information
nathan-roys authored Aug 15, 2023
1 parent afab634 commit 7dd0e66
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "pysnyk"
version = "0.9.9"
version = "0.9.10"
description = "A Python client for the Snyk API"
authors = [
"Gareth Rushgrove <[email protected]>",
Expand Down
11 changes: 10 additions & 1 deletion snyk/managers.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import abc
import json
from typing import Any, Dict, List

from deprecation import deprecated # type: ignore
Expand Down Expand Up @@ -143,7 +144,13 @@ def _rest_to_v1_response_format(self, project):
settings = attributes.get("settings", {})
recurring_tests = settings.get("recurring_tests", {})
issue_counts = project.get("meta", {}).get("latest_issue_counts")

remote_repo_url = (
project.get("relationships", {})
.get("target", {})
.get("data", {})
.get("attributes", {})
.get("url")
)
return {
"name": attributes.get("name"),
"id": project.get("id"),
Expand All @@ -161,6 +168,7 @@ def _rest_to_v1_response_format(self, project):
},
"targetReference": attributes.get("target_reference"),
"branch": attributes.get("target_reference"),
"remoteRepoUrl": remote_repo_url,
"_tags": attributes.get("tags", []),
"importingUserId": project.get("relationships", {})
.get("importer", {})
Expand Down Expand Up @@ -189,6 +197,7 @@ def _query(self, tags: List[Dict[str, str]] = [], next_url: str = None):
# Append the issue count param to the params if this is the first page
if not next_url:
params["meta.latest_issue_counts"] = "true"
params["expand"] = "target"

# And lastly, make the API call
resp = self.client.get(
Expand Down

0 comments on commit 7dd0e66

Please sign in to comment.