채널 관리
채널 생성·조회·수정과 구독, 멤버십, 슈퍼챗까지 SDK 메서드로 동작합니다.
생성·수정·구독·멤버십·슈퍼챗 등 쓰기 작업은 앱 멤버 JWT(cb.auth.signInMember)가 필요합니다.
| SDK 메서드 | 백엔드 |
|---|---|
createChannel(data) | POST /v1/public/channels (handle 은 전역 고유) |
getChannel(channelId) | GET /v1/public/channels/:channel_id |
getChannelByHandle(handle) | GET /v1/public/channels/handle/:handle |
updateChannel(channelId, data) | PATCH /v1/public/channels/:channel_id (소유자만) |
subscribeChannel / unsubscribeChannel | 채널 구독 토글 |
getMembershipTiers / joinMembership | 멤버십 등급 조회 / 가입 |
getSuperChats / sendSuperChat | 슈퍼챗 조회 / 전송 |
채널 CRUD
typescript
// 채널 생성 (앱 멤버 JWT 필요) — handle 은 전역 고유, 중복 시 409
const channel = await cb.video.createChannel({
handle: 'my-channel',
name: '내 채널',
description: '채널 설명',
})
// 조회 (id 또는 handle)
const byId = await cb.video.getChannel(channel.id)
const byHandle = await cb.video.getChannelByHandle('my-channel')
// 수정 (소유자만 — 다른 멤버가 호출하면 403)
await cb.video.updateChannel(channel.id, { name: '새 이름', avatar_url: 'https://...' })구독 · 멤버십
typescript
await cb.video.subscribeChannel(channel.id)
await cb.video.unsubscribeChannel(channel.id)
const tiers = await cb.video.getMembershipTiers(channel.id)
const membership = await cb.video.joinMembership(channel.id, tiers[0].id)슈퍼챗
슈퍼챗 전송은 결제가 필요한 2단계 흐름입니다 — 응답의 client_secret 으로 결제(Stripe)를 확정해야 노출됩니다. 대상은 videoId 또는 liveId 로 지정합니다.
typescript
// 전송 (앱 멤버 JWT 필요)
const res = await cb.video.sendSuperChat(channel.id, 5000, {
videoId: 'video-id',
message: '응원합니다!',
currency: 'USD',
})
// res.client_secret 으로 결제 확정 (Stripe PaymentIntent)
// 조회
const superChats = await cb.video.getSuperChats('video-id')