Skip to content

Commit

Permalink
fix #49
Browse files Browse the repository at this point in the history
  • Loading branch information
cowanator committed May 1, 2024
1 parent ad20404 commit 4e9fe29
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 11 deletions.
11 changes: 3 additions & 8 deletions src/api/execution.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
SuccessResponse,
LatestResultsResponse,
ExecutionParams,
ExecutionPerformance,
QueryEngine,
GetResultParams,
validateAndBuildGetResultParams,
} from "../types";
Expand Down Expand Up @@ -37,15 +37,10 @@ export class ExecutionAPI extends Router {
*/
async executeQuery(
queryID: number,
params?: ExecutionParams,
params: ExecutionParams = {},
): Promise<ExecutionResponse> {
// Extract possible ExecutionParams
let query_parameters: QueryParameter[] = [];
let performance = ExecutionPerformance.Medium;
if (params !== undefined) {
query_parameters = params.query_parameters ? params.query_parameters : [];
performance = performance ? performance : ExecutionPerformance.Medium;
}
const { query_parameters = [], performance = QueryEngine.Medium } = params;

const response = await this.post<ExecutionResponse>(`query/${queryID}/execute`, {
query_parameters,
Expand Down
6 changes: 3 additions & 3 deletions src/types/requestArgs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ import { QueryParameter } from "./queryParameter";
/// Optional parameters for query exection.
export interface ExecutionParams {
query_parameters?: QueryParameter[];
performance?: ExecutionPerformance;
performance?: QueryEngine;
}

/// Choice of execution engine when executing query via API [default = medium]
export enum ExecutionPerformance {
export enum QueryEngine {
Medium = "medium",
Large = "large",
}
Expand Down Expand Up @@ -184,7 +184,7 @@ export interface ExecuteQueryParams extends BaseParams {
/// Can be either medium or large.
/// Medium consumes 10 credits, and large consumes 20 credits, per run.
/// Default is medium.
performance: ExecutionPerformance;
performance: QueryEngine;
}

export interface BaseCRUDParams extends BaseParams {
Expand Down

0 comments on commit 4e9fe29

Please sign in to comment.