mirror of
				https://github.com/mealie-recipes/mealie.git
				synced 2025-10-31 02:03:35 -04:00 
			
		
		
		
	
		
			
	
	
		
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			52 lines
		
	
	
		
			1.2 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
|  | import { BaseAPI } from "./_base"; | ||
|  | 
 | ||
|  | export interface AppStatistics { | ||
|  |   totalRecipes: number; | ||
|  |   totalUsers: number; | ||
|  |   totalGroups: number; | ||
|  |   uncategorizedRecipes: number; | ||
|  |   untaggedRecipes: number; | ||
|  | } | ||
|  | 
 | ||
|  | const prefix = "/api"; | ||
|  | 
 | ||
|  | const routes = { | ||
|  |   debugVersion: `${prefix}/debug/version`, | ||
|  |   debug: `${prefix}/debug`, | ||
|  |   debugStatistics: `${prefix}/debug/statistics`, | ||
|  |   debugLastRecipeJson: `${prefix}/debug/last-recipe-json`, | ||
|  |   debugLog: `${prefix}/debug/log`, | ||
|  | 
 | ||
|  |   debugLogNum: (num: number) => `${prefix}/debug/log/${num}`, | ||
|  | }; | ||
|  | 
 | ||
|  | export class DebugAPI extends BaseAPI { | ||
|  |   /** Returns the current version of mealie | ||
|  |    */ | ||
|  |   async getMealieVersion() { | ||
|  |     return await this.requests.get(routes.debugVersion); | ||
|  |   } | ||
|  | 
 | ||
|  |   /** Returns general information about the application for debugging | ||
|  |    */ | ||
|  |   async getDebugInfo() { | ||
|  |     return await this.requests.get(routes.debug); | ||
|  |   } | ||
|  | 
 | ||
|  |   async getAppStatistics() { | ||
|  |     return await this.requests.get<AppStatistics>(routes.debugStatistics); | ||
|  |   } | ||
|  | 
 | ||
|  |   /** Doc Str | ||
|  |    */ | ||
|  |   async getLog(num: number) { | ||
|  |     return await this.requests.get(routes.debugLogNum(num)); | ||
|  |   } | ||
|  | 
 | ||
|  |   /** Returns a token to download a file | ||
|  |    */ | ||
|  |   async getLogFile() { | ||
|  |     return await this.requests.get(routes.debugLog); | ||
|  |   } | ||
|  | } |