refactor: update openapi base url and regenerate openapi document

This commit is contained in:
moonrailgun 2024-07-13 16:08:26 +08:00
parent 67bfda30bc
commit 616a623e40
5 changed files with 83 additions and 19 deletions

View File

@ -40,7 +40,7 @@ export type OpenAPIConfig = {
}; };
export const OpenAPI: OpenAPIConfig = { export const OpenAPI: OpenAPIConfig = {
BASE: '/open', BASE: 'http://localhost:12345/open',
CREDENTIALS: 'include', CREDENTIALS: 'include',
ENCODE_PATH: undefined, ENCODE_PATH: undefined,
HEADERS: undefined, HEADERS: undefined,

View File

@ -1207,19 +1207,26 @@ export class FeedService {
} }
/** /**
* Fetch workspace feed channel events
* @param data The data for the request. * @param data The data for the request.
* @param data.workspaceId * @param data.workspaceId
* @param data.channelId * @param data.channelId
* @param data.limit
* @param data.cursor
* @returns unknown Successful response * @returns unknown Successful response
* @throws ApiError * @throws ApiError
*/ */
public static feedEvents(data: $OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/events']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/events']['get']['res'][200]> { public static feedFetchEventsByCursor(data: $OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor']['get']['req']): CancelablePromise<$OpenApiTs['/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor']['get']['res'][200]> {
return __request(OpenAPI, { return __request(OpenAPI, {
method: 'GET', method: 'GET',
url: '/workspace/{workspaceId}/feed/{channelId}/events', url: '/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor',
path: { path: {
workspaceId: data.workspaceId, workspaceId: data.workspaceId,
channelId: data.channelId channelId: data.channelId
},
query: {
limit: data.limit,
cursor: data.cursor
} }
}); });
} }
@ -1280,4 +1287,22 @@ export class FeedService {
}); });
} }
/**
* integrate with github webhook
* @param data The data for the request.
* @param data.channelId
* @returns string Successful response
* @returns unknown Error response
* @throws ApiError
*/
public static feedIntegrationGithub(data: $OpenApiTs['/feed/{channelId}/github']['post']['req']): CancelablePromise<$OpenApiTs['/feed/{channelId}/github']['post']['res'][200] | $OpenApiTs['/feed/{channelId}/github']['post']['res'][200]> {
return __request(OpenAPI, {
method: 'POST',
url: '/feed/{channelId}/github',
path: {
channelId: data.channelId
}
});
}
} }

View File

@ -120,6 +120,7 @@ export type $OpenApiTs = {
telemetry: number; telemetry: number;
page: number; page: number;
survey: number; survey: number;
feed: number;
}; };
}; };
}; };
@ -1388,6 +1389,7 @@ export type $OpenApiTs = {
id: string; id: string;
workspaceId: string; workspaceId: string;
name: string; name: string;
notifyFrequency: string;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
_count: { _count: {
@ -1408,9 +1410,11 @@ export type $OpenApiTs = {
* Successful response * Successful response
*/ */
200: { 200: {
notificationIds: Array<(string)>;
id: string; id: string;
workspaceId: string; workspaceId: string;
name: string; name: string;
notifyFrequency: string;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
} | null; } | null;
@ -1422,7 +1426,9 @@ export type $OpenApiTs = {
req: { req: {
channelId: string; channelId: string;
requestBody: { requestBody: {
notificationIds?: Array<(string)>;
name: string; name: string;
notifyFrequency: string;
}; };
workspaceId: string; workspaceId: string;
}; };
@ -1431,26 +1437,31 @@ export type $OpenApiTs = {
* Successful response * Successful response
*/ */
200: { 200: {
notificationIds: Array<(string)>;
id: string; id: string;
workspaceId: string; workspaceId: string;
name: string; name: string;
notifyFrequency: string;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
} | null; } | null;
}; };
}; };
}; };
'/workspace/{workspaceId}/feed/{channelId}/events': { '/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor': {
get: { get: {
req: { req: {
channelId: string; channelId: string;
cursor?: string;
limit?: number;
workspaceId: string; workspaceId: string;
}; };
res: { res: {
/** /**
* Successful response * Successful response
*/ */
200: Array<{ 200: {
items: Array<{
id: string; id: string;
channelId: string; channelId: string;
createdAt: string; createdAt: string;
@ -1461,8 +1472,11 @@ export type $OpenApiTs = {
source: string; source: string;
senderId?: string | null; senderId?: string | null;
senderName?: string | null; senderName?: string | null;
url?: string | null;
important: boolean; important: boolean;
}>; }>;
nextCursor?: string;
};
}; };
}; };
}; };
@ -1471,6 +1485,8 @@ export type $OpenApiTs = {
req: { req: {
requestBody: { requestBody: {
name: string; name: string;
notifyFrequency: string;
notificationIds?: Array<(string)>;
}; };
workspaceId: string; workspaceId: string;
}; };
@ -1479,9 +1495,11 @@ export type $OpenApiTs = {
* Successful response * Successful response
*/ */
200: { 200: {
notificationIds: Array<(string)>;
id: string; id: string;
workspaceId: string; workspaceId: string;
name: string; name: string;
notifyFrequency: string;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
}; };
@ -1502,6 +1520,7 @@ export type $OpenApiTs = {
id: string; id: string;
workspaceId: string; workspaceId: string;
name: string; name: string;
notifyFrequency: string;
createdAt: string; createdAt: string;
updatedAt: string; updatedAt: string;
}; };
@ -1537,9 +1556,29 @@ export type $OpenApiTs = {
source: string; source: string;
senderId?: string | null; senderId?: string | null;
senderName?: string | null; senderName?: string | null;
url?: string | null;
important: boolean; important: boolean;
}; };
}; };
}; };
}; };
'/feed/{channelId}/github': {
post: {
req: {
channelId: string;
};
res: {
/**
* Error response
*/
200: {
message: string;
code: string;
issues?: Array<{
message: string;
}>;
};
};
};
};
}; };

View File

@ -30,5 +30,5 @@ export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, {
title: 'Tianji OpenAPI', title: 'Tianji OpenAPI',
description, description,
version: `v${version}`, version: `v${version}`,
baseUrl: '/open', baseUrl: 'http://localhost:12345/open',
}); });

File diff suppressed because one or more lines are too long