Updates
This commit is contained in:
+2
-2
@@ -2,12 +2,12 @@ import { APIResponseObject, DataCrudRequestMethods, DataCrudRequestMethodsLowerC
|
||||
type Param<T = {
|
||||
[k: string]: any;
|
||||
}> = {
|
||||
key?: string;
|
||||
body?: T;
|
||||
query?: T;
|
||||
useDefault?: boolean;
|
||||
path: string;
|
||||
method?: (typeof DataCrudRequestMethods)[number] | (typeof DataCrudRequestMethodsLowerCase)[number];
|
||||
apiKey?: string;
|
||||
};
|
||||
/**
|
||||
* # Query DSQL API
|
||||
@@ -16,5 +16,5 @@ export default function queryDSQLAPI<T = {
|
||||
[k: string]: any;
|
||||
}, P = {
|
||||
[k: string]: any;
|
||||
}>({ key, body, query, useDefault, path: passedPath, method, }: Param<T>): Promise<APIResponseObject<P>>;
|
||||
}>({ body, query, useDefault, path: passedPath, method, apiKey, }: Param<T>): Promise<APIResponseObject<P>>;
|
||||
export {};
|
||||
|
||||
+2
-2
@@ -4,7 +4,7 @@ import serializeQuery from "../../utils/serialize-query";
|
||||
/**
|
||||
* # Query DSQL API
|
||||
*/
|
||||
export default async function queryDSQLAPI({ key, body, query, useDefault, path: passedPath, method, }) {
|
||||
export default async function queryDSQLAPI({ body, query, useDefault, path: passedPath, method, apiKey, }) {
|
||||
const grabedHostNames = grabHostNames({ useDefault });
|
||||
const { host, port, scheme } = grabedHostNames;
|
||||
try {
|
||||
@@ -17,7 +17,7 @@ export default async function queryDSQLAPI({ key, body, query, useDefault, path:
|
||||
const reqPayload = body ? JSON.stringify(body) : undefined;
|
||||
let headers = {
|
||||
"Content-Type": "application/json",
|
||||
Authorization: key ||
|
||||
Authorization: apiKey ||
|
||||
(!method || method == "GET" || method == "get"
|
||||
? process.env.DSQL_READ_ONLY_API_KEY
|
||||
: undefined) ||
|
||||
|
||||
Reference in New Issue
Block a user