docs: upgrade openapi

This commit is contained in:
moonrailgun 2024-10-07 23:23:00 +08:00
parent de38363315
commit 1e57905f32
5 changed files with 493 additions and 22 deletions

View File

@ -47,7 +47,7 @@ export const OpenAPI: OpenAPIConfig = {
PASSWORD: undefined, PASSWORD: undefined,
TOKEN: undefined, TOKEN: undefined,
USERNAME: undefined, USERNAME: undefined,
VERSION: '1.13.1', VERSION: '1.15.7',
WITH_CREDENTIALS: false, WITH_CREDENTIALS: false,
interceptors: { interceptors: {
request: new Interceptors(), request: new Interceptors(),

View File

@ -51,6 +51,21 @@ export class UserService {
}); });
} }
/**
* @param data The data for the request.
* @param data.requestBody
* @returns unknown Successful response
* @throws ApiError
*/
public static userRegister(data: $OpenApiTs['/register']['post']['req']): CancelablePromise<$OpenApiTs['/register']['post']['res'][200]> {
return __request(OpenAPI, {
method: 'POST',
url: '/register',
body: data.requestBody,
mediaType: 'application/json'
});
}
} }
export class WorkspaceService { export class WorkspaceService {
@ -84,6 +99,21 @@ export class WorkspaceService {
}); });
} }
/**
* @param data The data for the request.
* @param data.requestBody
* @returns unknown Successful response
* @throws ApiError
*/
public static workspaceRename(data: $OpenApiTs['/workspace//rename']['patch']['req']): CancelablePromise<$OpenApiTs['/workspace//rename']['patch']['res'][200]> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/workspace//rename',
body: data.requestBody,
mediaType: 'application/json'
});
}
/** /**
* @param data The data for the request. * @param data The data for the request.
* @param data.workspaceId * @param data.workspaceId
@ -428,6 +458,24 @@ export class WebsiteService {
}); });
} }
/**
* @param data The data for the request.
* @param data.workspaceId
* @param data.websiteId
* @returns unknown Successful response
* @throws ApiError
*/
public static websiteDelete(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}']['delete']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}']['delete']['res'][200]> {
return __request(OpenAPI, {
method: 'DELETE',
url: '/workspace/{workspaceId}/website/{websiteId}',
path: {
workspaceId: data.workspaceId,
websiteId: data.websiteId
}
});
}
/** /**
* @param data The data for the request. * @param data The data for the request.
* @param data.workspaceId * @param data.workspaceId
@ -449,6 +497,68 @@ export class WebsiteService {
}); });
} }
/**
* @param data The data for the request.
* @param data.workspaceId
* @param data.websiteId
* @param data.requestBody
* @returns string Successful response
* @returns unknown Error response
* @throws ApiError
*/
public static websiteGenerateLighthouseReport(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/generateLighthouseReport']['post']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/generateLighthouseReport']['post']['res'][200] | $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/generateLighthouseReport']['post']['res'][200]> {
return __request(OpenAPI, {
method: 'POST',
url: '/workspace/{workspaceId}/website/{websiteId}/generateLighthouseReport',
path: {
workspaceId: data.workspaceId,
websiteId: data.websiteId
},
body: data.requestBody,
mediaType: 'application/json'
});
}
/**
* @param data The data for the request.
* @param data.workspaceId
* @param data.websiteId
* @param data.limit
* @param data.cursor
* @returns unknown Successful response
* @throws ApiError
*/
public static websiteGetLighthouseReport(data: $OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/getLighthouseReport']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/website/{websiteId}/getLighthouseReport']['get']['res'][200]> {
return __request(OpenAPI, {
method: 'GET',
url: '/workspace/{workspaceId}/website/{websiteId}/getLighthouseReport',
path: {
workspaceId: data.workspaceId,
websiteId: data.websiteId
},
query: {
limit: data.limit,
cursor: data.cursor
}
});
}
/**
* @param data The data for the request.
* @param data.lighthouseId
* @returns unknown Successful response
* @throws ApiError
*/
public static websiteGetLighthouseJson(data: $OpenApiTs['/lighthouse/{lighthouseId}']['get']['req']): CancelablePromise<$OpenApiTs['/lighthouse/{lighthouseId}']['get']['res'][200]> {
return __request(OpenAPI, {
method: 'GET',
url: '/lighthouse/{lighthouseId}',
path: {
lighthouseId: data.lighthouseId
}
});
}
} }
export class MonitorService { export class MonitorService {
@ -1316,6 +1426,7 @@ export class FeedService {
* @param data.channelId * @param data.channelId
* @param data.limit * @param data.limit
* @param data.cursor * @param data.cursor
* @param data.archived
* @returns unknown Successful response * @returns unknown Successful response
* @throws ApiError * @throws ApiError
*/ */
@ -1329,7 +1440,8 @@ export class FeedService {
}, },
query: { query: {
limit: data.limit, limit: data.limit,
cursor: data.cursor cursor: data.cursor,
archived: data.archived
} }
}); });
} }
@ -1390,6 +1502,86 @@ export class FeedService {
}); });
} }
/**
* @param data The data for the request.
* @param data.channelId
* @param data.eventId
* @param data.requestBody
* @returns unknown Successful response
* @throws ApiError
*/
public static feedArchiveEvent(data: $OpenApiTs['/feed/{channelId}/{eventId}/archive']['patch']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/{eventId}/archive']['patch']['res'][200]> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/feed/{channelId}/{eventId}/archive',
path: {
channelId: data.channelId,
eventId: data.eventId
},
body: data.requestBody,
mediaType: 'application/json'
});
}
/**
* @param data The data for the request.
* @param data.channelId
* @param data.eventId
* @param data.requestBody
* @returns unknown Successful response
* @throws ApiError
*/
public static feedUnarchiveEvent(data: $OpenApiTs['/feed/{channelId}/{eventId}/unarchive']['patch']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/{eventId}/unarchive']['patch']['res'][200]> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/feed/{channelId}/{eventId}/unarchive',
path: {
channelId: data.channelId,
eventId: data.eventId
},
body: data.requestBody,
mediaType: 'application/json'
});
}
/**
* @param data The data for the request.
* @param data.channelId
* @param data.requestBody
* @returns number Successful response
* @returns unknown Error response
* @throws ApiError
*/
public static feedClearAllArchivedEvents(data: $OpenApiTs['/feed/{channelId}/clearAllArchivedEvents']['patch']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/clearAllArchivedEvents']['patch']['res'][200] | $OpenApiTs['/feed/{channelId}/clearAllArchivedEvents']['patch']['res'][200]> {
return __request(OpenAPI, {
method: 'PATCH',
url: '/feed/{channelId}/clearAllArchivedEvents',
path: {
channelId: data.channelId
},
body: data.requestBody,
mediaType: 'application/json'
});
}
/**
* webhook playground
* @param data The data for the request.
* @param data.workspaceId
* @returns string Successful response
* @returns unknown Error response
* @throws ApiError
*/
public static feedIntegrationPlayground(data: $OpenApiTs['/feed/playground/{workspaceId}']['post']['req']): CancelablePromise<$OpenApiTs['/feed/playground/{workspaceId}']['post']['res'][200] | $OpenApiTs['/feed/playground/{workspaceId}']['post']['res'][200]> {
return __request(OpenAPI, {
method: 'POST',
url: '/feed/playground/{workspaceId}',
path: {
workspaceId: data.workspaceId
}
});
}
/** /**
* integrate with github webhook * integrate with github webhook
* @param data The data for the request. * @param data The data for the request.
@ -1426,4 +1618,22 @@ export class FeedService {
}); });
} }
/**
* integrate with sentry webhook
* @param data The data for the request.
* @param data.channelId
* @returns string Successful response
* @returns unknown Error response
* @throws ApiError
*/
public static feedIntegrationSentry(data: $OpenApiTs['/feed/{channelId}/sentry']['post']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/sentry']['post']['res'][200] | $OpenApiTs['/feed/{channelId}/sentry']['post']['res'][200]> {
return __request(OpenAPI, {
method: 'POST',
url: '/feed/{channelId}/sentry',
path: {
channelId: data.channelId
}
});
}
} }

View File

@ -43,10 +43,7 @@ export type $OpenApiTs = {
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
deletedAt: string | null; deletedAt: string | null;
currentWorkspace: { currentWorkspaceId: string | null;
id: string;
name: string;
};
workspaces: Array<{ workspaces: Array<{
role: string; role: string;
workspace: { workspace: {
@ -82,10 +79,44 @@ export type $OpenApiTs = {
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
deletedAt: string | null; deletedAt: string | null;
currentWorkspace: { currentWorkspaceId: string | null;
workspaces: Array<{
role: string;
workspace: {
id: string; id: string;
name: string; name: string;
}; };
}>;
};
token: string;
};
};
};
};
'/register': {
post: {
req: {
requestBody: {
username: string;
password: string;
};
};
res: {
/**
* Successful response
*/
200: {
info: {
id: string;
role: string;
username: string;
nickname: string | null;
avatar: string | null;
email: string | null;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
currentWorkspaceId: string | null;
workspaces: Array<{ workspaces: Array<{
role: string; role: string;
workspace: { workspace: {
@ -120,10 +151,7 @@ export type $OpenApiTs = {
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
deletedAt: string | null; deletedAt: string | null;
currentWorkspace: { currentWorkspaceId: string | null;
id: string;
name: string;
};
workspaces: Array<{ workspaces: Array<{
role: string; role: string;
workspace: { workspace: {
@ -156,10 +184,7 @@ export type $OpenApiTs = {
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
deletedAt: string | null; deletedAt: string | null;
currentWorkspace: { currentWorkspaceId: string | null;
id: string;
name: string;
};
workspaces: Array<{ workspaces: Array<{
role: string; role: string;
workspace: { workspace: {
@ -171,6 +196,25 @@ export type $OpenApiTs = {
}; };
}; };
}; };
'/workspace//rename': {
patch: {
req: {
requestBody: {
workspaceId: string;
name: string;
};
};
res: {
/**
* Successful response
*/
200: {
id: string;
name: string;
};
};
};
};
'/workspace//{workspaceId}': { '/workspace//{workspaceId}': {
delete: { delete: {
req: { req: {
@ -213,7 +257,7 @@ export type $OpenApiTs = {
post: { post: {
req: { req: {
requestBody: { requestBody: {
targetUserEmail: string; emailOrId: string;
}; };
workspaceId: string; workspaceId: string;
}; };
@ -501,6 +545,31 @@ export type $OpenApiTs = {
}; };
}; };
}; };
'/workspace/{workspaceId}/website/{websiteId}': {
delete: {
req: {
websiteId: string;
workspaceId: string;
};
res: {
/**
* Successful response
*/
200: {
id: string;
workspaceId: string;
name: string;
domain: string | null;
shareId: string | null;
resetAt: string | null;
monitorId: string | null;
createdAt: string;
updatedAt: string;
deletedAt: string | null;
};
};
};
};
'/workspace/{workspaceId}/website/{websiteId}/update': { '/workspace/{workspaceId}/website/{websiteId}/update': {
put: { put: {
req: { req: {
@ -531,6 +600,68 @@ export type $OpenApiTs = {
}; };
}; };
}; };
'/workspace/{workspaceId}/website/{websiteId}/generateLighthouseReport': {
post: {
req: {
requestBody: {
url: string;
};
websiteId: string;
workspaceId: string;
};
res: {
/**
* Error response
*/
200: {
message: string;
code: string;
issues?: Array<{
message: string;
}>;
};
};
};
};
'/workspace/{workspaceId}/website/{websiteId}/getLighthouseReport': {
get: {
req: {
cursor?: string;
limit?: number;
websiteId: string;
workspaceId: string;
};
res: {
/**
* Successful response
*/
200: {
items: Array<{
id: string;
status: 'Pending' | 'Success' | 'Failed';
url: string;
createdAt: string;
}>;
nextCursor?: string;
};
};
};
};
'/lighthouse/{lighthouseId}': {
get: {
req: {
lighthouseId: string;
};
res: {
/**
* Successful response
*/
200: {
[key: string]: unknown;
};
};
};
};
'/workspace/{workspaceId}/monitor/all': { '/workspace/{workspaceId}/monitor/all': {
get: { get: {
req: { req: {
@ -864,6 +995,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description: string; description: string;
body: {
[key: string]: unknown;
};
monitorList: Array<{ monitorList: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -890,6 +1024,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description: string; description: string;
body: {
[key: string]: unknown;
};
monitorList: Array<{ monitorList: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -908,6 +1045,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description?: string; description?: string;
body?: {
[key: string]: unknown;
};
monitorList?: Array<{ monitorList?: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -926,6 +1066,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description: string; description: string;
body: {
[key: string]: unknown;
};
monitorList: Array<{ monitorList: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -945,6 +1088,9 @@ export type $OpenApiTs = {
slug?: string; slug?: string;
title?: string; title?: string;
description?: string; description?: string;
body?: {
[key: string]: unknown;
};
monitorList?: Array<{ monitorList?: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -963,6 +1109,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description: string; description: string;
body: {
[key: string]: unknown;
};
monitorList: Array<{ monitorList: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -990,6 +1139,9 @@ export type $OpenApiTs = {
slug: string; slug: string;
title: string; title: string;
description: string; description: string;
body: {
[key: string]: unknown;
};
monitorList: Array<{ monitorList: Array<{
id: string; id: string;
showCurrent?: boolean; showCurrent?: boolean;
@ -1608,6 +1760,7 @@ export type $OpenApiTs = {
'/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor': { '/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor': {
get: { get: {
req: { req: {
archived?: boolean;
channelId: string; channelId: string;
cursor?: string; cursor?: string;
limit?: number; limit?: number;
@ -1631,6 +1784,10 @@ export type $OpenApiTs = {
senderName?: string | null; senderName?: string | null;
url?: string | null; url?: string | null;
important: boolean; important: boolean;
archived: boolean;
payload?: {
[key: string]: unknown;
} | null;
}>; }>;
nextCursor?: string; nextCursor?: string;
}; };
@ -1696,6 +1853,9 @@ export type $OpenApiTs = {
senderId?: string | null; senderId?: string | null;
senderName?: string | null; senderName?: string | null;
important: boolean; important: boolean;
payload?: {
[key: string]: unknown;
} | null;
}; };
}; };
res: { res: {
@ -1715,6 +1875,85 @@ export type $OpenApiTs = {
senderName?: string | null; senderName?: string | null;
url?: string | null; url?: string | null;
important: boolean; important: boolean;
archived: boolean;
payload?: {
[key: string]: unknown;
} | null;
};
};
};
};
'/feed/{channelId}/{eventId}/archive': {
patch: {
req: {
channelId: string;
eventId: string;
requestBody: {
workspaceId: string;
};
};
res: {
/**
* Successful response
*/
200: unknown;
};
};
};
'/feed/{channelId}/{eventId}/unarchive': {
patch: {
req: {
channelId: string;
eventId: string;
requestBody: {
workspaceId: string;
};
};
res: {
/**
* Successful response
*/
200: unknown;
};
};
};
'/feed/{channelId}/clearAllArchivedEvents': {
patch: {
req: {
channelId: string;
requestBody: {
workspaceId: string;
};
};
res: {
/**
* Error response
*/
200: {
message: string;
code: string;
issues?: Array<{
message: string;
}>;
};
};
};
};
'/feed/playground/{workspaceId}': {
post: {
req: {
workspaceId: string;
};
res: {
/**
* Error response
*/
200: {
message: string;
code: string;
issues?: Array<{
message: string;
}>;
}; };
}; };
}; };
@ -1757,4 +1996,23 @@ export type $OpenApiTs = {
}; };
}; };
}; };
'/feed/{channelId}/sentry': {
post: {
req: {
channelId: string;
};
res: {
/**
* Error response
*/
200: {
message: string;
code: string;
issues?: Array<{
message: string;
}>;
};
};
};
};
}; };

View File

@ -24,12 +24,15 @@ export const trpcOpenapiHttpHandler = createOpenApiHttpHandler({
createContext, createContext,
} as any); } as any);
const title = 'Tianji OpenAPI';
const description = ` const description = `
<h3>Insight into everything</h3> <h3>All-in-One Insight Hub</h3>
<p>Github: <a href="https://github.com/msgbyte/tianji" target="_blank">https://github.com/msgbyte/tianji</a></p> <p>Github: <a href="https://github.com/msgbyte/tianji" target="_blank">https://github.com/msgbyte/tianji</a></p>
`.trim(); `.trim();
export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, { export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, {
title: 'Tianji OpenAPI', title,
description, description,
version: `v${packageJson.default.version}`, version: `v${packageJson.default.version}`,
baseUrl: 'http://localhost:12345/open', baseUrl: 'http://localhost:12345/open',

File diff suppressed because one or more lines are too long