mirror of
https://github.com/immich-app/immich.git
synced 2026-05-18 03:10:24 +03:00
feat: plugins
chore: better types feat: plugins
This commit is contained in:
+150
-141
@@ -1478,72 +1478,33 @@ export type PersonStatisticsResponseDto = {
|
||||
/** Number of assets */
|
||||
assets: number;
|
||||
};
|
||||
export type PluginJsonSchemaProperty = {
|
||||
additionalProperties?: boolean | PluginJsonSchemaProperty;
|
||||
"default"?: any;
|
||||
description?: string;
|
||||
"enum"?: string[];
|
||||
items?: PluginJsonSchemaProperty;
|
||||
properties?: {
|
||||
[key: string]: PluginJsonSchemaProperty;
|
||||
};
|
||||
required?: string[];
|
||||
"type"?: PluginJsonSchemaType;
|
||||
};
|
||||
export type PluginJsonSchema = {
|
||||
additionalProperties?: boolean;
|
||||
description?: string;
|
||||
properties?: {
|
||||
[key: string]: PluginJsonSchemaProperty;
|
||||
};
|
||||
required?: string[];
|
||||
"type"?: PluginJsonSchemaType;
|
||||
};
|
||||
export type PluginActionResponseDto = {
|
||||
/** Action description */
|
||||
export type PluginMethodResponseDto = {
|
||||
/** Description */
|
||||
description: string;
|
||||
/** Action ID */
|
||||
id: string;
|
||||
/** Method name */
|
||||
methodName: string;
|
||||
/** Plugin ID */
|
||||
pluginId: string;
|
||||
/** Action schema */
|
||||
schema: (PluginJsonSchema) | null;
|
||||
/** Supported contexts */
|
||||
supportedContexts: PluginContextType[];
|
||||
/** Action title */
|
||||
title: string;
|
||||
};
|
||||
export type PluginFilterResponseDto = {
|
||||
/** Filter description */
|
||||
description: string;
|
||||
/** Filter ID */
|
||||
id: string;
|
||||
/** Method name */
|
||||
methodName: string;
|
||||
/** Plugin ID */
|
||||
pluginId: string;
|
||||
/** Filter schema */
|
||||
schema: (PluginJsonSchema) | null;
|
||||
/** Supported contexts */
|
||||
supportedContexts: PluginContextType[];
|
||||
/** Filter title */
|
||||
hostFunctions: boolean;
|
||||
/** Key */
|
||||
key: string;
|
||||
/** Name */
|
||||
name: string;
|
||||
schema?: {};
|
||||
/** Title */
|
||||
title: string;
|
||||
/** Workflow types */
|
||||
types: WorkflowType[];
|
||||
/** Ui hints */
|
||||
uiHints: string[];
|
||||
};
|
||||
export type PluginResponseDto = {
|
||||
/** Plugin actions */
|
||||
actions: PluginActionResponseDto[];
|
||||
/** Plugin author */
|
||||
author: string;
|
||||
/** Creation date */
|
||||
createdAt: string;
|
||||
/** Plugin description */
|
||||
description: string;
|
||||
/** Plugin filters */
|
||||
filters: PluginFilterResponseDto[];
|
||||
/** Plugin ID */
|
||||
id: string;
|
||||
/** Plugin methods */
|
||||
methods: PluginMethodResponseDto[];
|
||||
/** Plugin name */
|
||||
name: string;
|
||||
/** Plugin title */
|
||||
@@ -1553,10 +1514,6 @@ export type PluginResponseDto = {
|
||||
/** Plugin version */
|
||||
version: string;
|
||||
};
|
||||
export type PluginTriggerResponseDto = {
|
||||
contextType: PluginContextType;
|
||||
"type": PluginTriggerType;
|
||||
};
|
||||
export type QueueResponseDto = {
|
||||
/** Whether the queue is paused */
|
||||
isPaused: boolean;
|
||||
@@ -2710,89 +2667,81 @@ export type CreateProfileImageResponseDto = {
|
||||
/** User ID */
|
||||
userId: string;
|
||||
};
|
||||
export type PluginConfigValue = any;
|
||||
export type WorkflowActionConfig = {
|
||||
[key: string]: PluginConfigValue;
|
||||
};
|
||||
export type WorkflowActionResponseDto = {
|
||||
actionConfig: (WorkflowActionConfig) | null;
|
||||
/** Action ID */
|
||||
id: string;
|
||||
/** Action order */
|
||||
order: number;
|
||||
/** Plugin action ID */
|
||||
pluginActionId: string;
|
||||
/** Workflow ID */
|
||||
workflowId: string;
|
||||
};
|
||||
export type WorkflowFilterConfig = {
|
||||
[key: string]: PluginConfigValue;
|
||||
};
|
||||
export type WorkflowFilterResponseDto = {
|
||||
filterConfig: (WorkflowFilterConfig) | null;
|
||||
/** Filter ID */
|
||||
id: string;
|
||||
/** Filter order */
|
||||
order: number;
|
||||
/** Plugin filter ID */
|
||||
pluginFilterId: string;
|
||||
/** Workflow ID */
|
||||
workflowId: string;
|
||||
export type WorkflowStepDto = {
|
||||
/** Step configuration */
|
||||
config: {
|
||||
[key: string]: any;
|
||||
} | null;
|
||||
/** Step is enabled */
|
||||
enabled?: boolean;
|
||||
/** Step plugin method */
|
||||
method: string;
|
||||
};
|
||||
export type WorkflowResponseDto = {
|
||||
/** Workflow actions */
|
||||
actions: WorkflowActionResponseDto[];
|
||||
/** Creation date */
|
||||
createdAt: string;
|
||||
/** Workflow description */
|
||||
description: string;
|
||||
description: string | null;
|
||||
/** Workflow enabled */
|
||||
enabled: boolean;
|
||||
/** Workflow filters */
|
||||
filters: WorkflowFilterResponseDto[];
|
||||
/** Workflow ID */
|
||||
id: string;
|
||||
/** Workflow name */
|
||||
name: string | null;
|
||||
/** Owner user ID */
|
||||
ownerId: string;
|
||||
triggerType: PluginTriggerType;
|
||||
};
|
||||
export type WorkflowActionItemDto = {
|
||||
actionConfig?: WorkflowActionConfig;
|
||||
/** Plugin action ID */
|
||||
pluginActionId: string;
|
||||
};
|
||||
export type WorkflowFilterItemDto = {
|
||||
filterConfig?: WorkflowFilterConfig;
|
||||
/** Plugin filter ID */
|
||||
pluginFilterId: string;
|
||||
/** Workflow steps */
|
||||
steps: WorkflowStepDto[];
|
||||
/** Workflow trigger type */
|
||||
trigger: WorkflowTrigger;
|
||||
/** Update date */
|
||||
updatedAt: string;
|
||||
};
|
||||
export type WorkflowCreateDto = {
|
||||
/** Workflow actions */
|
||||
actions: WorkflowActionItemDto[];
|
||||
/** Workflow description */
|
||||
description?: string;
|
||||
description?: string | null;
|
||||
/** Workflow enabled */
|
||||
enabled?: boolean;
|
||||
/** Workflow filters */
|
||||
filters: WorkflowFilterItemDto[];
|
||||
/** Workflow name */
|
||||
name: string;
|
||||
triggerType: PluginTriggerType;
|
||||
name?: string | null;
|
||||
steps?: WorkflowStepDto[];
|
||||
/** Workflow trigger type */
|
||||
trigger: WorkflowTrigger;
|
||||
};
|
||||
export type WorkflowTriggerResponseDto = {
|
||||
/** Trigger type */
|
||||
trigger: WorkflowTrigger;
|
||||
/** Workflow types */
|
||||
types: WorkflowType[];
|
||||
};
|
||||
export type WorkflowUpdateDto = {
|
||||
/** Workflow actions */
|
||||
actions?: WorkflowActionItemDto[];
|
||||
/** Workflow description */
|
||||
description?: string;
|
||||
description?: string | null;
|
||||
/** Workflow enabled */
|
||||
enabled?: boolean;
|
||||
/** Workflow filters */
|
||||
filters?: WorkflowFilterItemDto[];
|
||||
/** Workflow name */
|
||||
name?: string;
|
||||
triggerType?: PluginTriggerType;
|
||||
name?: string | null;
|
||||
steps?: WorkflowStepDto[];
|
||||
/** Workflow trigger type */
|
||||
trigger?: WorkflowTrigger;
|
||||
};
|
||||
export type WorkflowShareStepDto = {
|
||||
/** Step configuration */
|
||||
config: {
|
||||
[key: string]: any;
|
||||
} | null;
|
||||
/** Step is enabled */
|
||||
enabled?: boolean;
|
||||
/** Step plugin method */
|
||||
method: string;
|
||||
};
|
||||
export type WorkflowShareResponseDto = {
|
||||
/** Workflow description */
|
||||
description: string | null;
|
||||
/** Workflow name */
|
||||
name: string | null;
|
||||
/** Workflow steps */
|
||||
steps: WorkflowShareStepDto[];
|
||||
/** Workflow trigger type */
|
||||
trigger: WorkflowTrigger;
|
||||
};
|
||||
export type LicenseResponseDto = UserLicense;
|
||||
export type SyncAckV1 = {};
|
||||
@@ -5240,22 +5189,56 @@ export function getPersonThumbnail({ id }: {
|
||||
/**
|
||||
* List all plugins
|
||||
*/
|
||||
export function getPlugins(opts?: Oazapfts.RequestOpts) {
|
||||
export function searchPlugins({ description, enabled, id, name, title, version }: {
|
||||
description?: string;
|
||||
enabled?: boolean;
|
||||
id?: string;
|
||||
name?: string;
|
||||
title?: string;
|
||||
version?: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: PluginResponseDto[];
|
||||
}>("/plugins", {
|
||||
}>(`/plugins${QS.query(QS.explode({
|
||||
description,
|
||||
enabled,
|
||||
id,
|
||||
name,
|
||||
title,
|
||||
version
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* List all plugin triggers
|
||||
* Retrieve plugin methods
|
||||
*/
|
||||
export function getPluginTriggers(opts?: Oazapfts.RequestOpts) {
|
||||
export function searchPluginMethods({ description, enabled, id, name, pluginName, pluginVersion, title, trigger, $type }: {
|
||||
description?: string;
|
||||
enabled?: boolean;
|
||||
id?: string;
|
||||
name?: string;
|
||||
pluginName?: string;
|
||||
pluginVersion?: string;
|
||||
title?: string;
|
||||
trigger?: WorkflowTrigger;
|
||||
$type?: WorkflowType;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: PluginTriggerResponseDto[];
|
||||
}>("/plugins/triggers", {
|
||||
data: PluginMethodResponseDto[];
|
||||
}>(`/plugins/methods${QS.query(QS.explode({
|
||||
description,
|
||||
enabled,
|
||||
id,
|
||||
name,
|
||||
pluginName,
|
||||
pluginVersion,
|
||||
title,
|
||||
trigger,
|
||||
"type": $type
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
@@ -6631,11 +6614,23 @@ export function getUniqueOriginalPaths(opts?: Oazapfts.RequestOpts) {
|
||||
/**
|
||||
* List all workflows
|
||||
*/
|
||||
export function getWorkflows(opts?: Oazapfts.RequestOpts) {
|
||||
export function searchWorkflows({ description, enabled, id, name, trigger }: {
|
||||
description?: string;
|
||||
enabled?: boolean;
|
||||
id?: string;
|
||||
name?: string;
|
||||
trigger?: WorkflowTrigger;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: WorkflowResponseDto[];
|
||||
}>("/workflows", {
|
||||
}>(`/workflows${QS.query(QS.explode({
|
||||
description,
|
||||
enabled,
|
||||
id,
|
||||
name,
|
||||
trigger
|
||||
}))}`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
@@ -6654,6 +6649,17 @@ export function createWorkflow({ workflowCreateDto }: {
|
||||
body: workflowCreateDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* List all workflow triggers
|
||||
*/
|
||||
export function getWorkflowTriggers(opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: WorkflowTriggerResponseDto[];
|
||||
}>("/workflows/triggers", {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
/**
|
||||
* Delete a workflow
|
||||
*/
|
||||
@@ -6694,6 +6700,19 @@ export function updateWorkflow({ id, workflowUpdateDto }: {
|
||||
body: workflowUpdateDto
|
||||
})));
|
||||
}
|
||||
/**
|
||||
* Retrieve a workflow
|
||||
*/
|
||||
export function getWorkflowForShare({ id }: {
|
||||
id: string;
|
||||
}, opts?: Oazapfts.RequestOpts) {
|
||||
return oazapfts.ok(oazapfts.fetchJson<{
|
||||
status: 200;
|
||||
data: WorkflowShareResponseDto;
|
||||
}>(`/workflows/${encodeURIComponent(id)}/share`, {
|
||||
...opts
|
||||
}));
|
||||
}
|
||||
export enum ReactionLevel {
|
||||
Album = "album",
|
||||
Asset = "asset"
|
||||
@@ -7017,21 +7036,11 @@ export enum PartnerDirection {
|
||||
SharedBy = "shared-by",
|
||||
SharedWith = "shared-with"
|
||||
}
|
||||
export enum PluginJsonSchemaType {
|
||||
String = "string",
|
||||
Number = "number",
|
||||
Integer = "integer",
|
||||
Boolean = "boolean",
|
||||
Object = "object",
|
||||
Array = "array",
|
||||
Null = "null"
|
||||
export enum WorkflowType {
|
||||
AssetV1 = "AssetV1",
|
||||
AssetPersonV1 = "AssetPersonV1"
|
||||
}
|
||||
export enum PluginContextType {
|
||||
Asset = "asset",
|
||||
Album = "album",
|
||||
Person = "person"
|
||||
}
|
||||
export enum PluginTriggerType {
|
||||
export enum WorkflowTrigger {
|
||||
AssetCreate = "AssetCreate",
|
||||
PersonRecognized = "PersonRecognized"
|
||||
}
|
||||
@@ -7098,7 +7107,7 @@ export enum JobName {
|
||||
VersionCheck = "VersionCheck",
|
||||
OcrQueueAll = "OcrQueueAll",
|
||||
Ocr = "Ocr",
|
||||
WorkflowRun = "WorkflowRun"
|
||||
WorkflowAssetCreate = "WorkflowAssetCreate"
|
||||
}
|
||||
export enum SearchSuggestionType {
|
||||
Country = "country",
|
||||
|
||||
Reference in New Issue
Block a user