Files
LabelChange-server/Bak/DAL/interfaces/ICustomerApiRepository.cs
2026-06-01 16:30:29 +08:00

83 lines
2.9 KiB
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System.Collections.Generic;
using System.Threading.Tasks;
using MDL.Models;
namespace DAL.Interfaces
{
/// <summary>
/// 客户API信息的数据访问接口
/// </summary>
public interface ICustomerApiRepository
{
/// <summary>
/// 创建客户API记录
/// </summary>
/// <param name="entity">客户API实体</param>
/// <returns>创建的记录ID</returns>
Task<int> CreateAsync(CustomerApiEntity entity);
/// <summary>
/// 根据ID获取客户API记录
/// </summary>
/// <param name="id">记录ID</param>
/// <returns>客户API实体</returns>
Task<CustomerApiEntity?> GetByIdAsync(int id);
/// <summary>
/// 根据客户ID获取客户API记录
/// </summary>
/// <param name="customerId">客户ID</param>
/// <returns>客户API实体列表</returns>
Task<List<CustomerApiEntity>> GetByCustomerIdAsync(int customerId);
/// <summary>
/// 根据客户代码获取客户API记录
/// </summary>
/// <param name="customerCode">客户代码</param>
/// <returns>客户API实体列表</returns>
Task<List<CustomerApiEntity>> GetByCustomerCodeAsync(string customerCode);
/// <summary>
/// 根据API密钥获取客户API记录
/// </summary>
/// <param name="apiKey">API密钥</param>
/// <returns>客户API实体</returns>
Task<CustomerApiEntity?> GetByApiKeyAsync(string apiKey);
/// <summary>
/// 验证客户API凭证并返回客户API信息
/// </summary>
/// <param name="customerCode">客户代码</param>
/// <param name="apiKey">API密钥</param>
/// <returns>客户API实体如果验证失败则返回null</returns>
Task<CustomerApiEntity?> ValidateAndGetApiCredentialsAsync(string customerCode, string apiKey);
/// <summary>
/// 验证客户API凭证
/// </summary>
/// <param name="customerCode">客户代码</param>
/// <param name="apiKey">API密钥</param>
/// <returns>是否验证通过</returns>
Task<bool> ValidateApiCredentialsAsync(string customerCode, string apiKey);
/// <summary>
/// 更新客户API记录
/// </summary>
/// <param name="entity">客户API实体</param>
/// <returns>更新是否成功</returns>
Task<bool> UpdateAsync(CustomerApiEntity entity);
/// <summary>
/// 删除客户API记录
/// </summary>
/// <param name="id">记录ID</param>
/// <returns>删除是否成功</returns>
Task<bool> DeleteAsync(int id);
/// <summary>
/// 获取所有客户API记录
/// </summary>
/// <returns>客户API实体列表</returns>
Task<List<CustomerApiEntity>> GetAllAsync();
}
}