- 팩
- 워크스페이스에서 사용할 수 있도록 게시된, 유료이며 버전이 지정된 스티커 에셋 모음입니다.
- 컬렉션
- 하나의 애플리케이션이 검색할 수 있는 활성화된 팩을 제어하는 무료 애플리케이션 설정입니다.
- 스티커
- 검색을 통해 선택하고 승인된 배리언트로 렌더링하는 안정적인 메타데이터 레코드입니다.
컬렉션은 팩을 구매하지 않습니다
컬렉션은 워크스페이스에서 이미 활성화된 호스팅 팩을 애플리케이션에 맞게 구성하는 무료 설정입니다. 팩을 사용 중지하면 새로운 검색과 타입어헤드 결과에서는 제외되지만, 기존 바인딩을 유지하면 과거 메시지를 정확히 렌더링할 수 있습니다.
- 01
호스팅 팩 활성화
유료 활성화 권한은 워크스페이스에 귀속됩니다.
- 02
컬렉션 생성
애플리케이션 또는 스티커 정책 경계마다 하나의 컬렉션을 사용하세요.
- 03
팩 사용 설정
이제 런타임 읽기 요청을 통해 컬렉션에서 해당 팩을 제공할 수 있습니다.
타입어헤드는 검색의 시작이며, 스티커 조회가 아닙니다
타입어헤드는 해변 같은 추천 검색어를 반환합니다. 선택한 추천어를 검색해야 스티커 레코드를 받을 수 있습니다. 메타데이터 및 resolve 호출에는 stickerId를 저장해 전달하세요. semanticId는 의미를 설명하는 값이며 스티커 경로 식별자로 사용할 수 없습니다.
CLI로 전체 흐름 테스트하기
# The API key stays in trusted server-side environment configuration.
export MEDIARUNTIME_API_KEY="sk_..."
collection_id='stc_11111111111111111111111111111111'
# Typeahead returns suggestion text, not stickers or delivery URLs.
mediaruntime stickers typeahead "해" --collection "$collection_id" --locale ko --limit 10 --json
# Search the selected suggestion to obtain complete sticker records.
mediaruntime stickers search "해변" --collection "$collection_id" --limit 10 --json
# Use stickerId—not semanticId—for metadata and asset routes.
sticker_id='sage-the-owl-summer-season-vacation-v1-beach-day'
mediaruntime stickers get "$sticker_id" --collection "$collection_id" --json
# Resolve only when the UI needs an approved representation.
mediaruntime stickers resolve "$sticker_id" --variant small_160 --collection "$collection_id" --json애플리케이션 코드에서도 컬렉션에 연결된 동일한 흐름을 구현하세요.
// npm install @mediaruntime/node
import { MediaRuntime } from "@mediaruntime/node";
// Never expose the workspace API key in browser or mobile code.
const media = new MediaRuntime({ apiKey: process.env.MEDIARUNTIME_API_KEY });
const stickers = media.stickers.collection("stc_11111111111111111111111111111111");
// Show these suggestion texts while the user types.
const typeahead = await stickers.typeahead("해", { locale: "ko", limit: 10 });
const selectedTerm = typeahead.suggestions[0]?.text;
if (!selectedTerm) throw new Error("No sticker suggestion matched");
// Search turns the selected term into stable sticker records.
const matches = await stickers.search(selectedTerm, { limit: 10 });
const selectedSticker = matches.items[0];
if (!selectedSticker) throw new Error("No sticker matched the selected suggestion");
// Persist stickerId in the message; signed delivery URLs expire.
const asset = await stickers.resolve(selectedSticker.stickerId, "small_160");
console.log(selectedSticker.stickerId, asset.url);서버 키 또는 범위가 제한된 클라이언트 토큰
신뢰할 수 있는 서버에서는 MEDIARUNTIME_API_KEY를 직접 사용할 수 있습니다. 브라우저와 모바일 애플리케이션에는 신뢰할 수 있는 서버가 필요에 따라 발급한 단기 토큰을 전달하고, 하나의 컬렉션과 명시적인 런타임 권한 범위(scope)로 권한을 제한해야 합니다.
URL이 아닌 참조를 저장하세요
메시지와 함께 stickerId, packId, packVersion을 저장하세요. 특정 생성 버전에 고정된 전송 URL은 의도적으로 수명이 짧으므로, 렌더링할 때 승인된 배리언트의 URL을 새로 확인해야 합니다.
스티커 컬렉션 및 런타임 엔드포인트
| 메서드 | 경로 | 용도 |
|---|---|---|
| GET | /v1/sticker-collections | 워크스페이스가 소유한 애플리케이션 컬렉션을 조회합니다. |
| PUT | /v1/sticker-collections/{collection_id}/packs/{pack_id} | 이미 활성화된 호스팅 팩을 하나의 컬렉션에서 사용 설정합니다. |
| GET | /v1/stickers/packs | 명시적인 collection_id에 사용 설정된 팩을 조회합니다. |
| GET | /v1/stickers/typeahead | 로케일을 반영한 추천 검색어를 반환합니다. 스티커 ID는 반환하지 않습니다. |
| GET | /v1/stickers/search | 사용 설정된 스티커 메타데이터를 검색하고 안정적인 stickerId 값을 반환합니다. |
| GET | /v1/stickers/{sticker_id} | semanticId가 아닌 stickerId로 스티커 하나를 조회합니다. |
| GET | /v1/stickers/{sticker_id}/assets/{variant} | 특정 생성 버전에 고정된 수명이 짧은 전송 URL을 반환합니다. |
| POST | /v1/sticker-runtime/client-tokens | 선택적으로 사용할 수 있는, 컬렉션 범위의 단기 클라이언트 토큰을 발급합니다. |
| GET | /v1/sticker-runtime/usage/current | 현재 공유 풀의 작업 사용량과 승인된 전송 사용량을 확인합니다. |