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 = {
BASE: '/open',
BASE: 'http://localhost:12345/open',
CREDENTIALS: 'include',
ENCODE_PATH: 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.workspaceId
* @param data.channelId
* @param data.limit
* @param data.cursor
* @returns unknown Successful response
* @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, {
method: 'GET',
url: '/workspace/{workspaceId}/feed/{channelId}/events',
url: '/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor',
path: {
workspaceId: data.workspaceId,
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;
page: number;
survey: number;
feed: number;
};
};
};
@ -1388,6 +1389,7 @@ export type $OpenApiTs = {
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
_count: {
@ -1408,9 +1410,11 @@ export type $OpenApiTs = {
* Successful response
*/
200: {
notificationIds: Array<(string)>;
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
} | null;
@ -1422,7 +1426,9 @@ export type $OpenApiTs = {
req: {
channelId: string;
requestBody: {
notificationIds?: Array<(string)>;
name: string;
notifyFrequency: string;
};
workspaceId: string;
};
@ -1431,38 +1437,46 @@ export type $OpenApiTs = {
* Successful response
*/
200: {
notificationIds: Array<(string)>;
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
} | null;
};
};
};
'/workspace/{workspaceId}/feed/{channelId}/events': {
'/workspace/{workspaceId}/feed/{channelId}/fetchEventsByCursor': {
get: {
req: {
channelId: string;
cursor?: string;
limit?: number;
workspaceId: string;
};
res: {
/**
* Successful response
*/
200: Array<{
id: string;
channelId: string;
createdAt: string;
updatedAt: string;
eventName: string;
eventContent: string;
tags: Array<(string)>;
source: string;
senderId?: string | null;
senderName?: string | null;
important: boolean;
}>;
200: {
items: Array<{
id: string;
channelId: string;
createdAt: string;
updatedAt: string;
eventName: string;
eventContent: string;
tags: Array<(string)>;
source: string;
senderId?: string | null;
senderName?: string | null;
url?: string | null;
important: boolean;
}>;
nextCursor?: string;
};
};
};
};
@ -1471,6 +1485,8 @@ export type $OpenApiTs = {
req: {
requestBody: {
name: string;
notifyFrequency: string;
notificationIds?: Array<(string)>;
};
workspaceId: string;
};
@ -1479,9 +1495,11 @@ export type $OpenApiTs = {
* Successful response
*/
200: {
notificationIds: Array<(string)>;
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
};
@ -1502,6 +1520,7 @@ export type $OpenApiTs = {
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
};
@ -1537,9 +1556,29 @@ export type $OpenApiTs = {
source: string;
senderId?: string | null;
senderName?: string | null;
url?: string | null;
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',
description,
version: `v${version}`,
baseUrl: '/open',
baseUrl: 'http://localhost:12345/open',
});

File diff suppressed because one or more lines are too long