AlipayContent.Apis.Interfaces
1.3.1
dotnet add package AlipayContent.Apis.Interfaces --version 1.3.1
NuGet\Install-Package AlipayContent.Apis.Interfaces -Version 1.3.1
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="AlipayContent.Apis.Interfaces" Version="1.3.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="AlipayContent.Apis.Interfaces" Version="1.3.1" />
<PackageReference Include="AlipayContent.Apis.Interfaces" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add AlipayContent.Apis.Interfaces --version 1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: AlipayContent.Apis.Interfaces, 1.3.1"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package AlipayContent.Apis.Interfaces@1.3.1
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=AlipayContent.Apis.Interfaces&version=1.3.1
#tool nuget:?package=AlipayContent.Apis.Interfaces&version=1.3.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
AlipayContent.Apis.Interfaces
支付宝内容发布API接口定义库,提供支付宝生活号+内容发布相关的接口定义和数据传输对象(DTO)。
功能特性
- 🚀 文件上传:支持本地文件上传和URL文件上传两种方式
- 📝 内容发布:支持短图文和视频内容发布
- 🔍 内容查询:支持单条内容状态查询
- ✅ 数据验证:内置完整的数据验证特性
- 📋 完整文档:提供详细的XML文档注释
支持的接口
文件上传接口
FileUpload
- 本地文件上传(支持大文件流式上传)FileUploadByUrl
- 通过URL上传文件
内容管理接口
ContentPublish
- 内容发布接口ContentQuery
- 单条内容状态查询接口ContentBatchQuery
- 批量内容查询接口ContentDelete
- 内容删除接口
安装
dotnet add package AlipayContent.Apis.Interfaces
使用示例
文件上传DTO
public class AlipayFileUploadDto
{
[Required(ErrorMessage = "上传文件不能为空")]
public IFormFile File { get; set; }
[Required(ErrorMessage = "素材使用场景不能为空")]
public string BizCode { get; set; } = "content_creation";
}
URL文件上传DTO
public class AlipayFileUploadByUrlDto
{
[Required(ErrorMessage = "文件URL地址不能为空")]
[Url(ErrorMessage = "请输入有效的URL地址")]
public string FileUrl { get; set; }
public string BizCode { get; set; } = "content_creation";
}
内容发布DTO
public class AlipayContentPublishDto
{
[Required(ErrorMessage = "内容类型不能为空")]
[RegularExpression("^[12]$", ErrorMessage = "内容类型只能是1(短图文)或2(视频)")]
public string SourceType { get; set; } = "1";
[MaxLength(128, ErrorMessage = "内容标题长度不能超过128位")]
public string? SourceTitle { get; set; }
}
批量内容查询DTO
public class AlipayContentBatchQueryInput
{
[MaxLength(32, ErrorMessage = "生活号+号ID长度不能超过32位")]
public string? PublicId { get; set; }
public bool NeedDetail { get; set; } = false;
[RegularExpression("^[0123]$", ErrorMessage = "内容状态只能是0(审核中)、1(发布成功)、2(审核不通过)或3(已删除)")]
public string? Status { get; set; }
[Range(1, int.MaxValue, ErrorMessage = "页码必须大于0")]
public int PageNum { get; set; } = 1;
[Range(1, 20, ErrorMessage = "分页大小必须在1-20之间")]
public int PageSize { get; set; } = 20;
}
内容删除DTO
public class AlipayContentDeleteInput
{
[Required(ErrorMessage = "内容ID不能为空")]
[MaxLength(64, ErrorMessage = "内容ID长度不能超过64位")]
public string ContentId { get; set; } = string.Empty;
[MaxLength(64, ErrorMessage = "生活号+号ID长度不能超过64位")]
public string? PublicId { get; set; }
}
数据验证
所有DTO类都包含完整的数据验证特性:
[Required]
- 必填字段验证[MaxLength]
- 最大长度验证[RegularExpression]
- 正则表达式验证[Url]
- URL格式验证[Range]
- 数值范围验证
版本要求
- .NET 9.0 或更高版本
- Microsoft.AspNetCore.Http.Features 5.0.17+
许可证
本项目采用 MIT 许可证 - 查看 LICENSE 文件了解详情。
贡献
欢迎提交问题和功能请求!
更新日志
v1.2.0
- 新增内容删除接口
- 支持删除指定内容ID的内容
- 完善内容管理功能
v1.1.0
- 新增批量内容查询接口
- 支持分页查询和内容详情返回
- 优化数据验证特性
v1.0.0
- 初始版本发布
- 支持文件上传(本地文件和URL文件)
- 支持内容发布和查询
- 完整的数据验证支持
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net9.0
- Microsoft.AspNetCore.Http.Features (>= 5.0.17)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
v1.3.0:
- 新增网络代理参数
v1.3.0:
- 接口统一改成Task异步
v1.2.0:
- 新增内容删除接口
- 支持删除指定内容ID的内容
- 完善内容管理功能
v1.1.0:
- 新增批量内容查询接口
- 支持分页查询和内容详情返回
- 优化数据验证特性
v1.0.0:
- 初始版本发布
- 支持文件上传(本地文件和URL文件)
- 支持内容发布和查询
- 完整的数据验证支持