Updates
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
import path from "path";
|
||||
import queryDSQLAPI from "../../functions/api/query-dsql-api";
|
||||
import {
|
||||
APIConnectionOptions,
|
||||
APIResponseObject,
|
||||
DSQL_DatabaseSchemaType,
|
||||
DSQL_FieldSchemaType,
|
||||
DSQL_TableSchemaType,
|
||||
} from "../../types";
|
||||
import grabAPIBasePath from "../../utils/grab-api-base-path";
|
||||
import { GrabHostNamesReturn } from "../../utils/grab-host-names";
|
||||
|
||||
type Params = {
|
||||
dbName: string;
|
||||
tableName?: string;
|
||||
fieldName?: string;
|
||||
apiKey?: string;
|
||||
apiConnectionConfig?: APIConnectionOptions;
|
||||
grabbedHostnames?: GrabHostNamesReturn;
|
||||
useDefault?: boolean;
|
||||
};
|
||||
|
||||
export default async function <
|
||||
T extends
|
||||
| DSQL_DatabaseSchemaType
|
||||
| DSQL_TableSchemaType
|
||||
| DSQL_FieldSchemaType = DSQL_DatabaseSchemaType
|
||||
>({
|
||||
dbName,
|
||||
tableName,
|
||||
apiKey,
|
||||
useDefault,
|
||||
fieldName,
|
||||
apiConnectionConfig,
|
||||
grabbedHostnames,
|
||||
}: Params): Promise<APIResponseObject<T>> {
|
||||
const basePath = grabAPIBasePath({ paradigm: "schema" });
|
||||
|
||||
const finalPath = path.join(
|
||||
basePath,
|
||||
dbName,
|
||||
tableName || "",
|
||||
fieldName || ""
|
||||
);
|
||||
|
||||
const GET_RES = await queryDSQLAPI<any, T>({
|
||||
method: "GET",
|
||||
path: finalPath,
|
||||
apiKey,
|
||||
useDefault,
|
||||
apiConnectionConfig,
|
||||
grabbedHostnames,
|
||||
});
|
||||
|
||||
return GET_RES;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import get from "./get";
|
||||
|
||||
const schema = {
|
||||
get,
|
||||
};
|
||||
|
||||
export default schema;
|
||||
Reference in New Issue
Block a user