lxrbckl
Version:
CRUD functionality to enhance readability and abstraction in projects, for both local and remote file management.
192 lines (130 loc) • 4.07 kB
TypeScript
declare function axiosGet(url: string): Promise<any>;
declare function getProjectPath(file?: string, delimeter?: string): string;
declare function fileSet(data: any, file: string, indent?: number, path?: string): Promise<void>;
declare function fileGet(file: string, path?: string, encoding?: BufferEncoding): Promise<any>;
declare function fileDel(file: string, path?: string): Promise<void>;
declare function dirSet(dir: string, path?: string): Promise<void>;
declare function dirGet(dir: string, path?: string): Promise<any>;
declare function dirDel(dir: string, path?: string): Promise<void>;
// types <
// >
// interfaces <
interface PropsConstructor {
token: string;
model?: string;
temperature?: number;
}
declare class openai {
private readonly _model;
private readonly _token;
private readonly _temperature;
constructor({ token, model, temperature }: PropsConstructor);
query(prompt: string): Promise<string>;
}
// types <
// >
// interfaces <
interface Constructor {
token: string;
owner: string;
indent?: number;
stringEncoding?: BufferEncoding;
bufferEncoding?: BufferEncoding;
}
interface Request {
endpoint: string;
parameters?: any;
propertyFromResult?: string;
elementFromProperty?: string;
}
interface RepositoryGet {
file: string;
branch: string;
repository: string;
displayError?: boolean;
propertyFromResult?: string;
}
interface RepositorySet {
file: string;
branch: string;
repository: string;
data: string | object;
retryOnError?: number;
displayError?: boolean;
commitMessage?: string;
}
declare class octokit {
private _octokit;
private _owner;
private readonly _token;
private readonly _indent;
private readonly _stringEncoding;
private readonly _bufferEncoding;
constructor({ token, owner, indent, stringEncoding, bufferEncoding }: Constructor);
set owner(newOwner: string);
request({ endpoint, parameters, elementFromProperty, propertyFromResult }: Request): Promise<any>;
private endpointFile;
repositoryGet({ file, branch, repository, displayError, propertyFromResult }: RepositoryGet): Promise<any>;
respositorySet({ data, file, branch, repository, retryOnError, displayError, commitMessage }: RepositorySet): Promise<boolean>;
}
// types <
type OnReadyCallback = (...args: any[]) => Promise<void>;
type InteractionCreateCallback = (...args: any[]) => Promise<void>;
// >
// interfaces <
interface Command {
ctx?: Interaction,
context(): commandBody;
run: (...args: any[]) => any | Promise<any>;
async registerChoices?: () => Promise<void>;
}
interface Commands {
[key: string]: Command
}
interface ConstructorParams {
guildId: string;
version?: string;
channelId: string;
intents?: number[];
commands?: Commands;
applicationId: string;
}
interface LoginParams {
token: string;
}
interface MessageChannel {
content: string;
isInline?: boolean;
codeBlock?: string;
isSpoiler?: boolean;
}
interface bodyOptions {
type: number;
name: string;
required: boolean;
description: string;
}
interface commandBody {
type?: number;
name?: string;
description?: string;
options?: bodyOptions[];
}
declare class discord {
private _client;
private _version;
private _guildId;
commands: Commands;
private _intents;
private _channelId;
private _applicationId;
constructor({ guildId, channelId, applicationId, commands, version, intents }: ConstructorParams);
login({ token }: LoginParams): void;
registerCommands(): void;
registerOnReady(callback: OnReadyCallback): Promise<void>;
registerInteractionCreate(callback: InteractionCreateCallback): Promise<void>;
registerCommandChoices(): Promise<void>;
messageChannel({ content, codeBlock, isInline, isSpoiler }: MessageChannel): void;
terminate(): void;
}
export { axiosGet, dirDel, dirGet, dirSet, discord, fileDel, fileGet, fileSet, getProjectPath, octokit, openai };