Files
file-tool-wails/frontend/wailsjs/go/models.ts

227 lines
6.1 KiB
TypeScript
Raw Normal View History

2026-06-17 08:05:20 +08:00
export namespace main {
export class AppConfig {
defaultOutputDir: string;
static createFrom(source: any = {}) {
return new AppConfig(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.defaultOutputDir = source["defaultOutputDir"];
}
}
export class FileResult {
success: boolean;
message: string;
path?: string;
size?: number;
originalSize?: number;
static createFrom(source: any = {}) {
return new FileResult(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.success = source["success"];
this.message = source["message"];
this.path = source["path"];
this.size = source["size"];
this.originalSize = source["originalSize"];
}
}
export class ProcessRequest {
inputPath: string;
outputPath?: string;
format?: string;
quality?: string;
qualityInt?: number;
width?: number;
height?: number;
angle?: number;
bgColor?: string;
bgRemoveColor?: services.ColorRGB;
text?: string;
threshold?: number;
shape?: services.CropShape;
brightness?: number;
contrast?: number;
saturation?: number;
grayscaleIntensity?: number;
sharpenAmount?: number;
blurRadius?: number;
flipH?: boolean;
flipV?: boolean;
maintainRatio?: boolean;
cropX?: number;
cropY?: number;
static createFrom(source: any = {}) {
return new ProcessRequest(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.inputPath = source["inputPath"];
this.outputPath = source["outputPath"];
this.format = source["format"];
this.quality = source["quality"];
this.qualityInt = source["qualityInt"];
this.width = source["width"];
this.height = source["height"];
this.angle = source["angle"];
this.bgColor = source["bgColor"];
this.bgRemoveColor = this.convertValues(source["bgRemoveColor"], services.ColorRGB);
this.text = source["text"];
this.threshold = source["threshold"];
this.shape = this.convertValues(source["shape"], services.CropShape);
this.brightness = source["brightness"];
this.contrast = source["contrast"];
this.saturation = source["saturation"];
this.grayscaleIntensity = source["grayscaleIntensity"];
this.sharpenAmount = source["sharpenAmount"];
this.blurRadius = source["blurRadius"];
this.flipH = source["flipH"];
this.flipV = source["flipV"];
this.maintainRatio = source["maintainRatio"];
this.cropX = source["cropX"];
this.cropY = source["cropY"];
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
export class RecentUse {
id: string;
name: string;
category: string;
usedAt: number;
static createFrom(source: any = {}) {
return new RecentUse(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.name = source["name"];
this.category = source["category"];
this.usedAt = source["usedAt"];
}
}
export class Shortcut {
id: string;
name: string;
category: string;
icon: string;
static createFrom(source: any = {}) {
return new Shortcut(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.id = source["id"];
this.name = source["name"];
this.category = source["category"];
this.icon = source["icon"];
}
}
}
export namespace services {
export class ColorRGB {
r: number;
g: number;
b: number;
static createFrom(source: any = {}) {
return new ColorRGB(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.r = source["r"];
this.g = source["g"];
this.b = source["b"];
}
}
export class Point {
x: number;
y: number;
static createFrom(source: any = {}) {
return new Point(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.x = source["x"];
this.y = source["y"];
}
}
export class CropShape {
type: string;
x: number;
y: number;
width: number;
height: number;
radius: number;
points: Point[];
static createFrom(source: any = {}) {
return new CropShape(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.type = source["type"];
this.x = source["x"];
this.y = source["y"];
this.width = source["width"];
this.height = source["height"];
this.radius = source["radius"];
this.points = this.convertValues(source["points"], Point);
}
convertValues(a: any, classs: any, asMap: boolean = false): any {
if (!a) {
return a;
}
if (a.slice && a.map) {
return (a as any[]).map(elem => this.convertValues(elem, classs));
} else if ("object" === typeof a) {
if (asMap) {
for (const key of Object.keys(a)) {
a[key] = new classs(a[key]);
}
return a;
}
return new classs(a);
}
return a;
}
}
}