2023-11-15 11:08:04 +00:00
|
|
|
import { EntityService, Common } from '@strapi/types';
|
|
|
|
|
|
|
|
import { errors } from '@strapi/utils';
|
|
|
|
|
|
|
|
type Entity = EntityService.Result<Common.UID.Schema>;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* POST /uid/generate
|
|
|
|
*/
|
|
|
|
export declare namespace GenerateUID {
|
|
|
|
export interface Request {
|
|
|
|
body: {
|
|
|
|
contentTypeUID: string;
|
|
|
|
data: Entity;
|
|
|
|
field: string;
|
|
|
|
};
|
2024-01-29 15:35:20 +00:00
|
|
|
query: {
|
|
|
|
locale?: string | null;
|
|
|
|
};
|
2023-11-15 11:08:04 +00:00
|
|
|
}
|
|
|
|
export interface Response {
|
2023-12-04 16:00:50 +00:00
|
|
|
data: string;
|
2023-11-15 11:08:04 +00:00
|
|
|
error?: errors.ApplicationError | errors.YupValidationError;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
|
|
* POST /uid/check-availability
|
|
|
|
*/
|
|
|
|
export declare namespace CheckUIDAvailability {
|
|
|
|
export interface Request {
|
|
|
|
body: {
|
|
|
|
contentTypeUID: string;
|
|
|
|
field: string;
|
|
|
|
value: string;
|
|
|
|
};
|
2024-01-29 15:35:20 +00:00
|
|
|
query: {
|
|
|
|
locale?: string | null;
|
|
|
|
};
|
2023-11-15 11:08:04 +00:00
|
|
|
}
|
2023-12-04 16:00:50 +00:00
|
|
|
export type Response =
|
|
|
|
| {
|
|
|
|
isAvailable: boolean;
|
|
|
|
suggestion: string | null;
|
|
|
|
error?: never;
|
|
|
|
}
|
|
|
|
| {
|
|
|
|
isAvailable?: never;
|
|
|
|
suggesiton?: never;
|
|
|
|
error?: errors.ApplicationError | errors.YupValidationError;
|
|
|
|
};
|
2023-11-15 11:08:04 +00:00
|
|
|
}
|