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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reading custom endpoint results SDK support #132

Merged
merged 10 commits into from
Jun 20, 2024
2 changes: 1 addition & 1 deletion dune_client/api/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
ResultsResponse,
)


# pylint: disable=duplicate-code
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely because of all the filter arguments and suggests a deeper change to the project. Introduce a ResultFilter structure that contains all the filtering possibilities:

@dataclass
class ResultFilter:
    limit: Optional[int] = None
    offset: Optional[int] = None
    columns: Optional[List[str]] = None
    sample_count: Optional[int] = None
    filters: Optional[str] = None
    sort_by: Optional[List[str]] = None

Then here would look more like:

    def get_custom_endpoint_result(
        self,
        handle: str,
        endpoint: str,
        filter: Optional[ResultFilter]
    ) -> ResultsResponse:

It would resolve both duplicated code lint warning and also reduce the "argument overload" lint error that is being globally suppressed here

max-args=10

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will log this and do at another time.

class CustomEndpointAPI(BaseRouter):
"""
Custom endpoints API implementation.
Expand Down
Loading