채널 관리
⚠️ 현재 상태(2026-04 기준) — SDK 와 백엔드 사이에 라우트 정렬이 아직 끝나지 않은 영역입니다. 아래 표의
상태칼럼을 반드시 확인하세요. 확실히 동작하는 것은 채널 구독 토글뿐입니다.
| SDK 메서드 | 동작 여부 | 비고 |
|---|---|---|
cb.video.subscribeChannel(channelId) | ✅ | POST /v1/public/channels/:channel_id/subscribe |
cb.video.unsubscribeChannel(channelId) | ✅ | DELETE /v1/public/channels/:channel_id/subscribe |
cb.video.createChannel / getChannel / getChannelByHandle / updateChannel | ❌ 404 | /v1/public/channels CRUD 라우트 없음. 콘솔에서 채널을 생성하세요. |
cb.video.getMembershipTiers(channelId) | ❌ 404 | SDK 가 /channels/:id/memberships/tiers 호출, 백엔드는 /channels/:id/membership/tiers (단수). 경로 정렬 전까지 사용 불가. |
cb.video.joinMembership(channelId, tierId) | ❌ 404 | SDK 가 /channels/:id/memberships/:tier_id/join 호출, 백엔드는 POST /v1/public/membership/join (body 사용). |
cb.video.sendSuperChat(videoId, amount, message?, currency?) | ❌ 404 | SDK 가 POST /videos/:id/super-chats 호출, 백엔드는 POST /v1/public/super-chats (body 에 video_id 또는 live_id). |
cb.video.getSuperChats(videoId) | ✅ | GET /v1/public/videos/:videoId/super-chats |
동작하는 예제: 채널 구독
typescript
await cb.video.subscribeChannel('channel-id')
await cb.video.unsubscribeChannel('channel-id')subscribeChannel / unsubscribeChannel 두 메서드만이 SDK ↔ 백엔드 경로가 일치합니다.
임시 우회: raw fetch 로 멤버십/슈퍼챗 직접 호출
SDK 메서드가 정렬되기 전까지는 fetch 로 직접 호출하면 됩니다.
typescript
// 멤버십 등급 조회 (singular path)
const res = await fetch(`https://api.connectbase.world/v1/public/channels/${channelId}/membership/tiers`, {
headers: { 'X-Public-Key': 'cb_pk_...' },
})
const { tiers } = await res.json()
// 멤버십 가입 — body 에 channel_id / tier_id 전달
await fetch('https://api.connectbase.world/v1/public/membership/join', {
method: 'POST',
headers: { 'X-Public-Key': 'cb_pk_...', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + appMemberToken },
body: JSON.stringify({ channel_id: channelId, tier_id: tierId }),
})
// 슈퍼챗 전송
await fetch('https://api.connectbase.world/v1/public/super-chats', {
method: 'POST',
headers: { 'X-Public-Key': 'cb_pk_...', 'Content-Type': 'application/json', 'Authorization': 'Bearer ' + appMemberToken },
body: JSON.stringify({ video_id: videoId, amount: 5000, message: '응원합니다!' }),
})📌 위 세 라우트는
auth.ClaimsParser+TokenTypeCheck(jwt.AppMember)미들웨어가 적용되어 있어 앱 멤버 JWT 가 필수입니다 (signInMember로 발급받은 토큰).