duneanalytics / dune-client

A framework for interacting with Dune Analytics' officially supported API service
Apache License 2.0
85 stars 22 forks source link

Break Client into Family of Classes #69

Closed bh2smith closed 1 year ago

bh2smith commented 1 year ago

DuneClient should inherit from (DuneExecutionsAPI, DuneQueryAPI, DuneUploadAPI…) where

Executions: execute_query() -> executionID get_execution_status() get_execution_results() get_execution_results_csv() cancel_execution()

Query: create_query() update_query() archive_query() get_query_results() get_query_results_csv()

Upload upload_csv()

Helper/higher-level-functionality

run_sql(sql :string) -> results
download_csv(queryID)
This is just an alias for: get_query_results_csv()
run_query() → this is the current refresh()
w/ maxAge=1hour for default ?
results_into_dataframe() ? (allows for an executionID or a queryID ?)

A simple function that accepts either of an executionID or a queryID, in case
    It is a query ID it will use “get_query_results_csv()” and load into pandas df
    If it specifies maxAge: it will trigger a new execution and use that executionID
    It is a execution ID it will use “get_execution_results_csv()” and load into pandas df