88 lines
2.8 KiB
C#
88 lines
2.8 KiB
C#
using Refit;
|
|
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CloudGaming.Core.AgileConfig.AgileConfigClient
|
|
{
|
|
/// <summary>
|
|
/// AgileConfig 的 API 客户端接口,用于与 AgileConfig 服务器交互
|
|
/// </summary>
|
|
public interface IAgileConfigClient
|
|
{
|
|
/// <summary>
|
|
/// 获取所有应用的列表
|
|
/// </summary>
|
|
/// <returns>包含所有应用的列表</returns>
|
|
[Get("/api/App")]
|
|
Task<List<ApiAppVM>> GetAllAppsAsync();
|
|
|
|
/// <summary>
|
|
/// 根据应用 ID 获取应用详情
|
|
/// </summary>
|
|
/// <param name="id">应用的唯一标识符</param>
|
|
/// <returns>应用的详细信息</returns>
|
|
[Get("/api/App/{id}")]
|
|
Task<ApiAppVM> GetAppByIdAsync(string id);
|
|
|
|
/// <summary>
|
|
/// 添加一个新的应用
|
|
/// </summary>
|
|
/// <param name="app">应用的详细信息</param>
|
|
/// <returns>异步任务</returns>
|
|
[Post("/api/App")]
|
|
Task AddAppAsync([Body] ApiAppVM app);
|
|
|
|
/// <summary>
|
|
/// 更新指定 ID 的应用
|
|
/// </summary>
|
|
/// <param name="id">应用的唯一标识符</param>
|
|
/// <param name="app">更新后的应用信息</param>
|
|
/// <returns>异步任务</returns>
|
|
[Put("/api/App/{id}")]
|
|
Task UpdateAppAsync(string id, [Body] ApiAppVM app);
|
|
|
|
/// <summary>
|
|
/// 删除指定 ID 的应用
|
|
/// </summary>
|
|
/// <param name="id">应用的唯一标识符</param>
|
|
/// <returns>异步任务</returns>
|
|
[Delete("/api/App/{id}")]
|
|
Task DeleteAppAsync(string id);
|
|
|
|
/// <summary>
|
|
/// 发布应用的配置
|
|
/// </summary>
|
|
/// <param name="appId">应用的唯一标识符</param>
|
|
/// <param name="env">发布的环境(如:生产、测试)</param>
|
|
/// <returns>异步任务</returns>
|
|
[Post("/api/App/publish")]
|
|
Task PublishAppConfigAsync([Query] string appId, [Query] string env);
|
|
|
|
[Get("/api/Config/app/{appId}")]
|
|
Task<List<ApiConfigVM>> GetAppConfigsAsync(string appId, string env = null);
|
|
|
|
[Get("/api/Config")]
|
|
Task<List<ApiConfigVM>> GetAppConfigAsync(string appId, string env = null);
|
|
|
|
// Add new configuration
|
|
[Post("/api/Config")]
|
|
Task AddConfigAsync([Body] ApiConfigVM config, string env = null);
|
|
|
|
// Fetch all nodes
|
|
[Get("/api/Node")]
|
|
Task<List<ApiNodeVM>> GetAllNodesAsync();
|
|
|
|
// Add a new node
|
|
[Post("/api/Node")]
|
|
Task AddNodeAsync([Body] ApiNodeVM node);
|
|
|
|
// Delete node by address
|
|
[Delete("/api/Node")]
|
|
Task DeleteNodeAsync(string address);
|
|
}
|
|
}
|