import { grabChecksumOfThemeCssFile, grabCommmunityThemeCssFile, grabLastCommitDateForFile } from "../features/githubUtils"; import { themeDelete, themeSave, themesCheckAndUpdates } from "../features/themes"; import type BratPlugin from "../main"; // This module is for API access for use in debuging console export default class BratAPI { plugin: BratPlugin; constructor(plugin: BratPlugin) { this.plugin = plugin; } console = (logDescription: string, ...outputs: (string | number | boolean)[]): void => { console.log(`BRAT: ${logDescription}`, ...outputs); }; themes = { themeseCheckAndUpates: async (showInfo: boolean): Promise => { await themesCheckAndUpdates(this.plugin, showInfo); }, themeInstallTheme: async (cssGithubRepository: string): Promise => { const scrubbedAddress = cssGithubRepository.replace("https://github.com/", ""); await themeSave(this.plugin, scrubbedAddress, true); }, themesDelete: (cssGithubRepository: string): void => { const scrubbedAddress = cssGithubRepository.replace("https://github.com/", ""); themeDelete(this.plugin, scrubbedAddress); }, grabCommmunityThemeCssFile: async (repositoryPath: string, betaVersion = false): Promise => { return await grabCommmunityThemeCssFile(repositoryPath, betaVersion, this.plugin.settings.debuggingMode); }, grabChecksumOfThemeCssFile: async (repositoryPath: string, betaVersion = false): Promise => { return await grabChecksumOfThemeCssFile(repositoryPath, betaVersion, this.plugin.settings.debuggingMode); }, grabLastCommitDateForFile: async (repositoryPath: string, path: string): Promise => { // example await grabLastCommitDateForAFile(t.repo, "theme-beta.css"); return await grabLastCommitDateForFile(repositoryPath, path); }, }; }