mirror of
https://github.com/strapi/strapi.git
synced 2025-07-19 07:02:26 +00:00

Co-authored-by: Jamie Howard <48524071+jhoward1994@users.noreply.github.com> Co-authored-by: Josh <37798644+joshuaellis@users.noreply.github.com>
94 lines
1.7 KiB
TypeScript
94 lines
1.7 KiB
TypeScript
import { errors } from '@strapi/utils';
|
|
|
|
import type { ApiToken } from '../../server/src/services/api-token';
|
|
|
|
type ApiTokenBody = Pick<ApiToken, 'lifespan' | 'description' | 'type' | 'name' | 'permissions'>;
|
|
type ApiTokenResponse = Omit<ApiToken, 'accessKey'>;
|
|
|
|
/**
|
|
* POST /api-tokens - Create an api token
|
|
*/
|
|
export declare namespace Create {
|
|
export interface Request {
|
|
body: ApiTokenBody;
|
|
query: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: ApiToken;
|
|
error?: errors.ApplicationError | errors.YupValidationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* GET /api-tokens - List api tokens
|
|
*/
|
|
export declare namespace List {
|
|
export interface Request {
|
|
body: {};
|
|
query: {};
|
|
}
|
|
|
|
export interface Response {
|
|
data: ApiTokenResponse[];
|
|
error?: errors.ApplicationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* DELETE /api-tokens/:id - Delete an API token
|
|
*/
|
|
export declare namespace Revoke {
|
|
export interface Request {
|
|
body: {};
|
|
query: {};
|
|
}
|
|
|
|
export interface Params {
|
|
id: number;
|
|
}
|
|
|
|
export interface Response {
|
|
data: ApiTokenResponse;
|
|
error?: errors.ApplicationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* GET /api-tokens/:id - Get an API token
|
|
*/
|
|
export declare namespace Get {
|
|
export interface Request {
|
|
body: {};
|
|
query: {};
|
|
}
|
|
|
|
export interface Params {
|
|
id: number;
|
|
}
|
|
|
|
export interface Response {
|
|
data: ApiTokenResponse;
|
|
error?: errors.ApplicationError;
|
|
}
|
|
}
|
|
|
|
/**
|
|
* POST /api-tokens/:id - Update an API token
|
|
*/
|
|
export declare namespace Update {
|
|
export interface Request {
|
|
body: ApiTokenBody;
|
|
query: {};
|
|
}
|
|
|
|
export interface Params {
|
|
id: number;
|
|
}
|
|
|
|
export interface Response {
|
|
data: ApiTokenResponse;
|
|
error?: errors.ApplicationError | errors.YupValidationError;
|
|
}
|
|
}
|