2024-01-17 15:13:55 +01:00
|
|
|
import { Attribute, Common, Schema } from '@strapi/types';
|
2023-12-04 10:10:51 +01:00
|
|
|
import type { Release, Pagination } from './releases';
|
2023-11-21 09:18:12 +01:00
|
|
|
import type { Entity } from '../types';
|
|
|
|
|
|
|
|
import type { errors } from '@strapi/utils';
|
|
|
|
|
2024-01-17 15:13:55 +01:00
|
|
|
export type ReleaseActionEntry = Entity & {
|
2023-11-21 09:18:12 +01:00
|
|
|
// Entity attributes
|
|
|
|
[key: string]: Attribute.Any;
|
2023-12-12 10:43:39 +01:00
|
|
|
} & {
|
2024-01-04 10:18:21 +01:00
|
|
|
locale?: string;
|
2023-11-21 09:18:12 +01:00
|
|
|
};
|
|
|
|
|
2023-12-04 10:10:51 +01:00
|
|
|
export interface ReleaseAction extends Entity {
|
2023-11-21 09:18:12 +01:00
|
|
|
type: 'publish' | 'unpublish';
|
|
|
|
entry: ReleaseActionEntry;
|
|
|
|
contentType: Common.UID.ContentType;
|
2024-01-04 10:18:21 +01:00
|
|
|
locale?: string;
|
2023-11-21 09:18:12 +01:00
|
|
|
release: Release;
|
|
|
|
}
|
|
|
|
|
2024-01-17 15:13:55 +01:00
|
|
|
export interface FormattedReleaseAction extends Entity {
|
|
|
|
type: 'publish' | 'unpublish';
|
|
|
|
entry: ReleaseActionEntry;
|
|
|
|
contentType: {
|
|
|
|
uid: Common.UID.ContentType;
|
|
|
|
mainFieldValue?: string;
|
|
|
|
displayName: string;
|
|
|
|
};
|
|
|
|
locale?: {
|
|
|
|
name: string;
|
|
|
|
code: string;
|
|
|
|
};
|
|
|
|
release: Release;
|
|
|
|
}
|
|
|
|
|
2023-11-21 09:18:12 +01:00
|
|
|
/**
|
2023-12-05 11:00:29 +01:00
|
|
|
* POST /content-releases/:releaseId/actions - Create a release action
|
2023-11-21 09:18:12 +01:00
|
|
|
*/
|
|
|
|
export declare namespace CreateReleaseAction {
|
|
|
|
export interface Request {
|
|
|
|
params: {
|
|
|
|
releaseId: Release['id'];
|
|
|
|
};
|
|
|
|
body: {
|
|
|
|
type: ReleaseAction['type'];
|
|
|
|
entry: {
|
|
|
|
id: ReleaseActionEntry['id'];
|
2024-01-04 10:18:21 +01:00
|
|
|
locale?: ReleaseActionEntry['locale'];
|
2023-11-21 09:18:12 +01:00
|
|
|
contentType: Common.UID.ContentType;
|
|
|
|
};
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Response {
|
2023-11-23 11:15:29 +01:00
|
|
|
data: ReleaseAction;
|
|
|
|
error?: errors.ApplicationError | errors.ValidationError | errors.NotFoundError;
|
2023-11-21 09:18:12 +01:00
|
|
|
}
|
|
|
|
}
|
2023-12-04 10:10:51 +01:00
|
|
|
|
|
|
|
/**
|
|
|
|
* GET /content-releases/:id/actions - Get all release actions
|
|
|
|
*/
|
2024-01-04 10:18:21 +01:00
|
|
|
|
|
|
|
export type ReleaseActionGroupBy = 'contentType' | 'action' | 'locale';
|
2023-12-04 10:10:51 +01:00
|
|
|
export declare namespace GetReleaseActions {
|
|
|
|
export interface Request {
|
|
|
|
params: {
|
|
|
|
releaseId: Release['id'];
|
|
|
|
};
|
2024-01-04 10:18:21 +01:00
|
|
|
query?: Partial<Pick<Pagination, 'page' | 'pageSize'>> & {
|
|
|
|
groupBy?: ReleaseActionGroupBy;
|
|
|
|
};
|
2023-12-04 10:10:51 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
export interface Response {
|
2024-01-04 10:18:21 +01:00
|
|
|
data: {
|
2024-01-17 15:13:55 +01:00
|
|
|
[key: string]: Array<FormattedReleaseAction>;
|
2024-01-04 10:18:21 +01:00
|
|
|
};
|
2023-12-04 10:10:51 +01:00
|
|
|
meta: {
|
|
|
|
pagination: Pagination;
|
2024-01-17 15:13:55 +01:00
|
|
|
contentTypes: Record<Schema.ContentType['uid'], Schema.ContentType>;
|
|
|
|
components: Record<Schema.Component['uid'], Schema.Component>;
|
2023-12-04 10:10:51 +01:00
|
|
|
};
|
2023-12-05 11:00:29 +01:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/*
|
|
|
|
* DELETE /content-releases/:releaseId/actions/:actionId - Delete a release action
|
|
|
|
*/
|
|
|
|
export declare namespace DeleteReleaseAction {
|
|
|
|
export interface Request {
|
|
|
|
params: {
|
|
|
|
actionId: ReleaseAction['id'];
|
|
|
|
releaseId: Release['id'];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Response {
|
|
|
|
data: ReleaseAction;
|
2023-12-04 10:10:51 +01:00
|
|
|
error?: errors.ApplicationError | errors.NotFoundError;
|
|
|
|
}
|
|
|
|
}
|
2023-12-04 14:14:00 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* PUT /content-releases/:releaseId/actions/:actionId - Update a release action
|
|
|
|
*/
|
|
|
|
export declare namespace UpdateReleaseAction {
|
|
|
|
export interface Request {
|
|
|
|
params: {
|
2023-12-12 10:43:39 +01:00
|
|
|
actionId: ReleaseAction['id'];
|
2023-12-04 14:14:00 +01:00
|
|
|
releaseId: ReleaseAction['id'];
|
|
|
|
};
|
|
|
|
body: {
|
|
|
|
type: ReleaseAction['type'];
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
export interface Response {
|
|
|
|
data: ReleaseAction;
|
|
|
|
error?: errors.ApplicationError | errors.ValidationError | errors.NotFoundError;
|
|
|
|
}
|
|
|
|
}
|