频道
复制一个包含安装步骤和该插件的完整 Markdown 指南的设置提示。
频道是管理应用程序更新的核心机制,Capgo 中的频道允许您控制用户如何和何时接收更新,启用 A/B 测试、分阶段发布和平台特定更新等功能。
了解频道
《理解频道》频道代表您的应用程序更新的分发轨迹。每个频道都可以配置特定的规则和约束:
- 捆绑包(版本)控制: 指定用户接收的捆绑包(版本)
- 平台目标: 目标特定的平台(iOS/Android/Electron)
- 更新策略: 控制更新的传递
- 设备限制: 管理可以访问更新的设备
频道配置选项
《频道配置选项》- public: 设为新设备的默认频道
- disableAutoUpdateUnderNative: 当设备的原生应用版本新于更新包(版本)可用的频道(例如,设备在原生应用版本 1.2.3,频道有更新包(版本) 1.2.2)时,防止更新
- disableAutoUpdate: 控制更新行为(“major”,“minor”,“版本号”,“none”)
- ios/android/electron: 为特定平台启用/禁用
- allow_device_self_set: 允许设备选择频道
- allow_emulator: 允许在模拟器设备上更新
- allow_dev: 开发环境下允许更新
最佳实践
: 内部验证的测试渠道- : 分段更新: 分离的平台
- : 控制版本允许版本控制
- 允许版本控制允许版本控制
- 允许版本控制允许版本控制 semantic versioning 为了清晰的更新路径
Endpoints
EndpointsPOST
POSThttps://api.capgo.app/channel/
创建或更新一个频道配置
请求体
请求体type disable_update = "major" | "minor" | "version_number" | "none"interface ChannelSet { app_id: string channel: string version?: string // bundle (version) name public?: boolean disableAutoUpdateUnderNative?: boolean disableAutoUpdate?: disable_update ios?: boolean android?: boolean electron?: boolean allow_device_self_set?: boolean allow_emulator?: boolean allow_dev?: boolean}示例请求
示例请求curl -X POST \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "channel": "beta", "version": "1.2.0", "public": false, "disableAutoUpdate": "minor", "ios": true, "android": true, "electron": true, "allow_emulator": true }' \ https://api.capgo.app/channel/成功响应
成功响应{ "status": "ok"}GET
GEThttps://api.capgo.app/channel/
获取频道信息。每页返回50个频道。
查询参数
频道ID:必填。您的应用IDapp_id页码:可选。分页时的页码page__CAPGO_KEEP_0__channel: 必填。具体的频道名称
示例请求
频道“示例请求”# Get all channelscurl -H "authorization: your-api-key" \ "https://api.capgo.app/channel/?app_id=app_123"
# Get specific channelcurl -H "authorization: your-api-key" \ "https://api.capgo.app/channel/?app_id=app_123&channel=beta"
# Get next pagecurl -H "authorization: your-api-key" \ "https://api.capgo.app/channel/?app_id=app_123&page=1"响应类型
频道“响应类型”interface Channel { id: number; created_at: string; name: string; app_id: string; version: { // bundle (version) assigned to the channel id: number, name: string }; created_by: string; updated_at: string; public: boolean; disableAutoUpdateUnderNative: boolean; disableAutoUpdate: boolean; allow_emulator: boolean; allow_dev: boolean;}在下面的响应中, version 指的是分配给频道的包(版本)
示例响应
频道“示例响应”{ "data": [ { "id": 1, "name": "production", "app_id": "app_123", "version": { "id": 1, "name": "1.0.0" }, "created_at": "2024-01-01T00:00:00Z", "updated_at": "2024-01-01T00:00:00Z", "created_by": "user_123", "public": true, "disableAutoUpdateUnderNative": false, "disableAutoUpdate": false, "allow_emulator": false, "allow_dev": false } ]}删除
标题:删除https://api.capgo.app/channel/
删除一个频道。请注意,这将影响所有使用此频道的设备。
查询参数
标题:查询参数interface Channel { channel: string app_id: string}示例请求
标题:示例请求curl -X DELETE \ -H "authorization: your-api-key" \ -H "Content-Type: application/json" \ -d '{ "app_id": "app_123", "channel": "beta" }' \ https://api.capgo.app/channel/成功响应
成功响应{ "status": "ok"}错误处理
错误处理常见错误场景及其响应:
// Channel not found{ "error": "Channel not found", "status": "KO"}
// Invalid bundle (version) format{ "error": "Invalid version format. Use semantic versioning", "status": "KO"}
// Invalid update policy{ "error": "Invalid disableAutoUpdate value", "status": "KO"}
// Permission denied{ "error": "Insufficient permissions to manage channels", "status": "KO"}常见用例
常见用例- 测试
{ "app_id": "app_123", "channel": "beta", "version": "1.2.0-beta", "public": false, "allow_emulator": true, "allow_dev": true}- 生产发布
{ "app_id": "app_123", "channel": "production", "version": "1.2.0", "public": true, "disableAutoUpdate": "minor"}- 平台特定更新
{ "app_id": "app_123", "channel": "ios-hotfix", "version": "1.2.1", "ios": true, "android": false}从 Channels 中继续
标题:从 Channels 中继续如果您正在使用 Channels 来规划频道路由和分阶段发布,连接它与 Channels 来 Channels 中的实现细节 Channels 来 Channels 中的实现细节 Beta 测试解决方案 为 Beta Testing Solution 产品工作流程 版本目标解决方案 为版本目标解决方案 产品工作流程, Capgo 环境最佳实践:使用一个移动应用ID进行分阶段 为 Capgo 环境最佳实践:使用一个移动应用ID进行分阶段的实际背景