🐛 fix(oauth): Refactor OAuth configuration types and update related API methods
This commit is contained in:
@@ -226,9 +226,9 @@ export async function updateNodeConfig(body: API.NodeConfig, options?: { [key: s
|
||||
});
|
||||
}
|
||||
|
||||
/** Get OAuth config GET /v1/admin/system/oauth_config */
|
||||
/** Get oauth config GET /v1/admin/system/oauth_config */
|
||||
export async function getOAuthConfig(options?: { [key: string]: any }) {
|
||||
return request<API.Response & { data?: API.OAuthQueryResponse }>(
|
||||
return request<API.Response & { data?: API.GetOAuthConfigResponse }>(
|
||||
'/v1/admin/system/oauth_config',
|
||||
{
|
||||
method: 'GET',
|
||||
@@ -238,7 +238,10 @@ export async function getOAuthConfig(options?: { [key: string]: any }) {
|
||||
}
|
||||
|
||||
/** Update oauth config PUT /v1/admin/system/oauth_config */
|
||||
export async function updateOAuthConfig(body: API.OAuthConfig, options?: { [key: string]: any }) {
|
||||
export async function updateOAuthConfig(
|
||||
body: API.UpdateOAuthConfig,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/system/oauth_config', {
|
||||
method: 'PUT',
|
||||
headers: {
|
||||
@@ -249,17 +252,17 @@ export async function updateOAuthConfig(body: API.OAuthConfig, options?: { [key:
|
||||
});
|
||||
}
|
||||
|
||||
/** OAuth create config POST /v1/admin/system/oauth_config */
|
||||
export async function oAuthCreateConfig(
|
||||
body: API.OAuthCreateRequest,
|
||||
/** Get OAuth Config By Platform GET /v1/admin/system/oauth/platform */
|
||||
export async function getOAuthByPlatform(
|
||||
// 叠加生成的Param类型 (非body参数swagger默认没有生成对象)
|
||||
params: API.GetOAuthByPlatformParams,
|
||||
options?: { [key: string]: any },
|
||||
) {
|
||||
return request<API.Response & { data?: any }>('/v1/admin/system/oauth_config', {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
return request<API.Response & { data?: API.OAuthMethod }>('/v1/admin/system/oauth/platform', {
|
||||
method: 'GET',
|
||||
params: {
|
||||
...params,
|
||||
},
|
||||
data: body,
|
||||
...(options || {}),
|
||||
});
|
||||
}
|
||||
|
||||
+26
-20
@@ -27,6 +27,7 @@ declare namespace API {
|
||||
};
|
||||
|
||||
type ApplicationConfig = {
|
||||
encryption: boolean;
|
||||
domains: string[];
|
||||
startup_picture: string;
|
||||
startup_picture_skip_time: number;
|
||||
@@ -457,6 +458,18 @@ declare namespace API {
|
||||
list: Server[];
|
||||
};
|
||||
|
||||
type GetOAuthByPlatformParams = {
|
||||
platform: string;
|
||||
};
|
||||
|
||||
type GetOAuthByPlatformRequest = {
|
||||
platform: string;
|
||||
};
|
||||
|
||||
type GetOAuthConfigResponse = {
|
||||
list: OAuthMethod[];
|
||||
};
|
||||
|
||||
type GetOrderListParams = {
|
||||
page: number;
|
||||
size: number;
|
||||
@@ -619,29 +632,14 @@ declare namespace API {
|
||||
last_at: number;
|
||||
};
|
||||
|
||||
type OAuthConfig = {
|
||||
type OAuthMethod = {
|
||||
id: number;
|
||||
platform: 'github' | 'google' | 'apple' | 'qq' | 'wechat' | 'telegram' | 'facebook';
|
||||
team_id: string;
|
||||
key_id: string;
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
platform: string;
|
||||
config: Record<string, any>;
|
||||
redirect: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
|
||||
type OAuthCreateRequest = {
|
||||
platform: 'github' | 'google' | 'apple' | 'qq' | 'wechat' | 'telegram' | 'facebook';
|
||||
team_id: string;
|
||||
key_id: string;
|
||||
client_id: string;
|
||||
client_secret: string;
|
||||
enabled: boolean;
|
||||
redirect: string;
|
||||
};
|
||||
|
||||
type OAuthQueryResponse = {
|
||||
list: OAuthConfig[];
|
||||
created_at: number;
|
||||
updated_at: number;
|
||||
};
|
||||
|
||||
type OnlineUser = {
|
||||
@@ -1126,6 +1124,14 @@ declare namespace API {
|
||||
sort: number;
|
||||
};
|
||||
|
||||
type UpdateOAuthConfig = {
|
||||
id: number;
|
||||
platform: string;
|
||||
config: Record<string, any>;
|
||||
redirect: string;
|
||||
enabled: boolean;
|
||||
};
|
||||
|
||||
type UpdateOrderStatusRequest = {
|
||||
id: number;
|
||||
status: number;
|
||||
|
||||
Reference in New Issue
Block a user