/
githubmirror
/
strapi
Обзор
Документация
Войти
/
githubmirror
/
strapi
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
develop
packages/core/admin/shared/contracts/content-api-token.ts
113 строк
2 KB
Nico André
feat(admin): api token supports admin permissions and admin user ownership (#25657)
29 апр 2026, 18:57
Не верифицирован
29 апр 2026, 18:57
52b8fd9
Код
Авторство
О чём код?
import { errors } from '@strapi/utils'; import type { Data } from '@strapi/types'; export type ApiTokenBase = { accessKey?: string; encryptedKey?: string; createdAt: string; description: string; expiresAt: string; id: Data.ID; lastUsedAt: string | null; lifespan: string | number | null; name: string; updatedAt: string; }; export type ContentApiApiToken = ApiTokenBase & { kind: 'content-api'; type: 'custom' | 'full-access' | 'read-only'; permissions: string[]; }; export type ContentApiApiTokenBody = Pick<ContentApiApiToken, 'name' | 'description' | 'type'> & { lifespan?: ContentApiApiToken['lifespan'] | null; permissions?: ContentApiApiToken['permissions'] | null; }; /** * POST /api-tokens - Create a content-api token */ export declare namespace Create { export interface Request { body: ContentApiApiTokenBody; query: {}; } export interface Response { data: ContentApiApiToken; error?: errors.ApplicationError | errors.YupValidationError; } } /** * GET /api-tokens - List content-api tokens */ export declare namespace List { export interface Request { body: {}; query: {}; } export interface Response { data: ContentApiApiToken[]; error?: errors.ApplicationError; } } /** * DELETE /api-tokens/:id - Delete a content-api token */ export declare namespace Revoke { export interface Request { body: {}; query: {}; } export interface Params { id: Data.ID; } export interface Response { data: ContentApiApiToken; error?: errors.ApplicationError; } } /** * GET /api-tokens/:id - Get a content-api token */ export declare namespace Get { export interface Request { body: {}; query: {}; } export interface Params { id: Data.ID; } export interface Response { data: ContentApiApiToken; error?: errors.ApplicationError; } } /** * PUT /api-tokens/:id - Update a content-api token */ export declare namespace Update { export interface Request { body: Partial<ContentApiApiTokenBody>; query: {}; } export interface Params { id: Data.ID; } export interface Response { data: ContentApiApiToken; error?: errors.ApplicationError | errors.YupValidationError; } }