Skip to content

Commit

Permalink
refactor: update openapi base url and regenerate openapi document
Browse files Browse the repository at this point in the history
  • Loading branch information
moonrailgun committed Jul 13, 2024
1 parent 67bfda3 commit 616a623
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 19 deletions.
2 changes: 1 addition & 1 deletion packages/client-sdk/src/open/client/core/OpenAPI.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
29 changes: 27 additions & 2 deletions packages/client-sdk/src/open/client/services.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
});
}
Expand Down Expand Up @@ -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
}
});
}

}
67 changes: 53 additions & 14 deletions packages/client-sdk/src/open/client/types.gen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export type $OpenApiTs = {
telemetry: number;
page: number;
survey: number;
feed: number;
};
};
};
Expand Down Expand Up @@ -1388,6 +1389,7 @@ export type $OpenApiTs = {
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
_count: {
Expand All @@ -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;
Expand All @@ -1422,7 +1426,9 @@ export type $OpenApiTs = {
req: {
channelId: string;
requestBody: {
notificationIds?: Array<(string)>;
name: string;
notifyFrequency: string;
};
workspaceId: string;
};
Expand All @@ -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;
};
};
};
};
Expand All @@ -1471,6 +1485,8 @@ export type $OpenApiTs = {
req: {
requestBody: {
name: string;
notifyFrequency: string;
notificationIds?: Array<(string)>;
};
workspaceId: string;
};
Expand All @@ -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;
};
Expand All @@ -1502,6 +1520,7 @@ export type $OpenApiTs = {
id: string;
workspaceId: string;
name: string;
notifyFrequency: string;
createdAt: string;
updatedAt: string;
};
Expand Down Expand Up @@ -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;
}>;
};
};
};
};
};
2 changes: 1 addition & 1 deletion src/server/trpc/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ export const trpcOpenapiDocument = generateOpenApiDocument(appRouter, {
title: 'Tianji OpenAPI',
description,
version: `v${version}`,
baseUrl: '/open',
baseUrl: 'http://localhost:12345/open',
});
2 changes: 1 addition & 1 deletion website/openapi.json

Large diffs are not rendered by default.

0 comments on commit 616a623

Please sign in to comment.