Skip to content

Commit

Permalink
add docstring to funciton
Browse files Browse the repository at this point in the history
  • Loading branch information
bh2smith committed Mar 16, 2024
1 parent b7c2070 commit e63fb4f
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/api/client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,9 +237,14 @@ export class DuneClient {
return results;
}

/**
* Allows for anyone to upload a CSV as a table in Dune.
* The size limit per upload is currently 200MB.
* Storage is limited by plan, 1MB on free, 15GB on plus, and 50GB on premium.
* @param params UploadCSVParams relevant fields related to dataset upload.
* @returns boolean representing if upload was successful.
*/
async uploadCsv(params: UploadCSVParams): Promise<boolean> {
params.description = params.description !== undefined ? params.description : "";
params.is_private = params.is_private !== undefined ? params.is_private : false;
const response = await this.exec.post<SuccessResponse>("table/upload/csv", params);
try {
return Boolean(response.success);
Expand Down
11 changes: 9 additions & 2 deletions tests/e2e/client.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,11 +101,18 @@ describe("DuneClient Extensions", () => {

it("uploadCSV", async () => {
const premiumClient = new DuneClient(PLUS_KEY);
const success = await premiumClient.uploadCsv({
const public_success = await premiumClient.uploadCsv({
table_name: "ts_client_test",
description: "testing csv upload from node",
data: "column1,column2\nvalue1,value2\nvalue3,value4",
});
expect(success).to.be.equal(true);
expect(public_success).to.be.equal(true);

const private_success = await premiumClient.uploadCsv({
table_name: "ts_client_test_private",
data: "column1,column2\nvalue1,value2\nvalue3,value4",
is_private: true
});
expect(private_success).to.be.equal(true);
});
});

0 comments on commit e63fb4f

Please sign in to comment.