openblox
Version:
Roblox API Wrapper For Both Classic And OpenCloud APIs.
93 lines (92 loc) • 3.09 kB
TypeScript
import { ObjectPrettify } from "typeforge";
import { HttpHandlerProps, HttpResponse } from "../http/http.utils";
export type PollConfig = ObjectPrettify<{
iterations?: number;
multiplyer?: number;
retryOffset?: number;
debug?: boolean;
}>;
export declare const pollMethod: <MethodBase extends Promise<({
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
} & {
again: () => Promise<{
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
}>;
}) | ({
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
cursors: {
previous: import("../apis/apiGroup/apiGroup.types").Cursor;
next: import("../apis/apiGroup/apiGroup.types").Cursor;
};
[Symbol.asyncIterator]: () => AsyncGenerator<{
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
cursors: {
previous: import("../apis/apiGroup/apiGroup.types").Cursor;
next: import("../apis/apiGroup/apiGroup.types").Cursor;
};
[Symbol.asyncIterator]: null;
} & {
again: () => Promise<{
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
}>;
}, any, unknown>;
} & {
again: () => Promise<{
data: any;
response: {
fullResponse: unknown;
url: `https://${string}`;
method: import("../utils/utils.types").RestMethod;
success: boolean;
statusCode: number;
headers: Headers;
body: any;
};
}>;
})>, Method extends MethodBase | Awaited<MethodBase>>(method: Method, handlerFn: (result: Awaited<MethodBase>, stopPolling: () => void) => Promise<boolean | void>, config?: PollConfig) => Promise<Awaited<Method>>;
export declare const pollHttp: <Body extends unknown>(httpArgs: HttpHandlerProps, handlerFn: (result: HttpResponse<Body>, stopPolling: () => void) => Promise<boolean | void>, config?: PollConfig) => Promise<void>;