This commit is contained in:
Benjamin Toby
2025-01-09 10:40:10 +01:00
parent 4bda9149c6
commit 0e49418bc4
3 changed files with 24 additions and 21 deletions
+14 -12
View File
@@ -1225,22 +1225,24 @@ export type CookieObject = {
sameSite?: "Strict" | "Lax" | "None";
priority?: "Low" | "Medium" | "High";
};
export type HttpRequestParams = RequestOptions & {
export type HttpRequestParams<ReqObj> = RequestOptions & {
scheme?: "http" | "https";
body?: {
[key: string]: any;
};
query?: {
[key: string]: any;
};
body?: ReqObj;
query?: ReqObj;
urlEncodedFormBody?: boolean;
};
export type HttpRequestFunctionType = (param: HttpRequestParams) => Promise<HttpFunctionResponse>;
export type HttpFunctionResponse = {
export type HttpRequestFunctionType<ReqObj extends {
[key: string]: any;
} = {
[key: string]: any;
}, ResObj extends {
[key: string]: any;
} = {
[key: string]: any;
}> = (param: HttpRequestParams<ReqObj>) => Promise<HttpFunctionResponse<ResObj>>;
export type HttpFunctionResponse<ResObj> = {
status: number;
data?: {
[key: string]: any;
};
data?: ResObj;
error?: string;
str?: string;
};
+9 -8
View File
@@ -1444,20 +1444,21 @@ export type CookieObject = {
priority?: "Low" | "Medium" | "High";
};
export type HttpRequestParams = RequestOptions & {
export type HttpRequestParams<ReqObj> = RequestOptions & {
scheme?: "http" | "https";
body?: { [key: string]: any };
query?: { [key: string]: any };
body?: ReqObj;
query?: ReqObj;
urlEncodedFormBody?: boolean;
};
export type HttpRequestFunctionType = (
param: HttpRequestParams
) => Promise<HttpFunctionResponse>;
export type HttpRequestFunctionType<
ReqObj extends { [key: string]: any } = { [key: string]: any },
ResObj extends { [key: string]: any } = { [key: string]: any }
> = (param: HttpRequestParams<ReqObj>) => Promise<HttpFunctionResponse<ResObj>>;
export type HttpFunctionResponse = {
export type HttpFunctionResponse<ResObj> = {
status: number;
data?: { [key: string]: any };
data?: ResObj;
error?: string;
str?: string;
};