IContentPersonalizationServer
コンテンツパーソナライゼーションサーバーのインターフェイス
メソッド
setContentEntitlementsHandler()
setContentEntitlementsHandler(contentEntitlementsHandler: IContentEntitlementsHandler):
void
パラメーター
contentEntitlementsHandler
setContentEntitlementsHandlerForComponent()
setContentEntitlementsHandlerForComponent(contentEntitlementsHandler: IContentEntitlementsHandler, component:
IComponentInstance):void
コマンドに応答してコンテンツエンタイトルメントデータを提供する、特定のコンポーネントのハンドラーを設定します。
パラメーター
contentEntitlementsHandler
コンテンツエンタイトルメントに関するコマンドのハンドラー。
component
IComponentInstance
ハンドラーを設定する対象のコンポーネントインスタンス。
例
import {
ContentPersonalizationServer,
CustomerListType,
IContentEntitlementsHandler,
IContentEntitlementsProvider,
ICustomerListEntriesHandler,
...
} from "@amazon-devices/kepler-content-personalization";
...
// ハンドラー
const contentEntitlementsHandler: IContentEntitlementsHandler = {
getAllContentEntitlements: (
contentEntitlementsProvider: IContentEntitlementsProvider,
) => {
contentEntitlementsProvider.addContentEntitlementChunk(<ADD ENTITLEMENTS>);
contentEntitlementsProvider.commit();
},
};
...
// ヘッドレスサービス
onStart(componentInstance: IComponentInstance): Promise<void> {
ContentPersonalizationServer.setContentEntitlementsHandlerForComponent(
contentEntitlementsHandler,
componentInstance,
);
// ここでほかのハンドラーを設定します。「SubscriptionEntitlementServer」も対象です
...
return Promise.resolve();
}
setCustomerListEntriesHandler()
setCustomerListEntriesHandler(customerListEntriesHandler: ICustomerListEntriesHandler):
void
パラメーター
customerListEntriesHandler
setCustomerListEntriesHandlerForComponent()
setCustomerListEntriesHandlerForComponent(customerListEntriesHandler: ICustomerListEntriesHandler, component:
IComponentInstance):void
コマンドに応答してユーザーリストエントリデータを提供する、特定のコンポーネントのハンドラーを設定します。
パラメーター
customerListEntriesHandler
ユーザーリストに関するコマンドのハンドラー。
component
IComponentInstance
ハンドラーを設定する対象のコンポーネントインスタンス。
例
import {
ContentPersonalizationServer,
CustomerListType,
IContentEntitlementsHandler,
IContentEntitlementsProvider,
ICustomerListEntriesHandler,
...
} from "@amazon-devices/kepler-content-personalization";
...
// ハンドラー
const customerListEntriesHandler: ICustomerListEntriesHandler = {
getAllCustomerListEntries: (
listType: CustomerListType,
customerListEntriesProvider: ICustomerListEntriesProvider,
) => {
customerListEntriesProvider.addCustomerListChunk(listType, <リストエントリを追加>);
customerListEntriesProvider.commit();
},
};
...
// ヘッドレスサービス
onStart(componentInstance: IComponentInstance): Promise<void> {
ContentPersonalizationServer.setCustomerListEntriesHandlerForComponent(
customerListEntriesHandler,
componentInstance,
);
// ここでほかのハンドラーを設定します。「SubscriptionEntitlementServer」も対象です
...
return Promise.resolve();
}
setPlaybackEventsHandler()
setPlaybackEventsHandler(playbackEventsHandler: IPlaybackEventsHandler):
void
パラメーター
playbackEventsHandler
setPlaybackEventsHandlerForComponent()
setPlaybackEventsHandlerForComponent(playbackEventsHandler: IPlaybackEventsHandler, component:
IComponentInstance):void
コマンドに応答して再生イベントデータを提供する、特定のコンポーネントのハンドラーを設定します。
パラメーター
playbackEventsHandler
再生イベントに関するコマンドのハンドラー。
component
IComponentInstance
ハンドラーを設定する対象のコンポーネントインスタンス。
例
import {
ContentPersonalizationServer,
CustomerListType,
IContentEntitlementsHandler,
IContentEntitlementsProvider,
ICustomerListEntriesHandler,
...
} from "@amazon-devices/kepler-content-personalization";
...
// ハンドラー
const playbackEventsHandler: IPlaybackEventsHandler = {
getPlaybackEventsSince: (
sinceTimestamp: Date,
playbackEventsProvider: IPlaybackEventsProvider,
) => {
playbackEventsProvider.addPlaybackEventChunk(<ADD PLAYBACK EVENTS>);
playbackEventsProvider.commit();
},
};
...
// ヘッドレスサービス
onStart(componentInstance: IComponentInstance): Promise<void> {
ContentPersonalizationServer.setPlaybackEventsHandlerForComponent(
playbackEventsHandler,
componentInstance,
);
// ここでほかのハンドラーを設定します。「SubscriptionEntitlementServer」も対象です
...
return Promise.resolve();
}
reportNewContentInteraction()
reportNewContentInteraction(contentInteraction: IContentInteraction):
void
ユーザーがコンテンツに反応したことを報告します(例:「好き」や「好きではない」を選択した、予告編を視聴した)。
パラメーター
contentInteraction
発生したコンテンツインタラクション。
例
const contentInteraction : IContentInteraction = new ContentInteractionBuilder()
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
.interactionTimestamp(new Date())
.contentInteractionType(ContentInteractionType.INGRESS)
.profileId(
new ProfileIdBuilder()
.id('myProfileId1')
.idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
.build(),
)
.build();
// イベントを送信します
ContentPersonalizationServer.reportNewContentInteraction(
contentInteraction,
);
reportNewPlaybackEvent()
reportNewPlaybackEvent(playbackEvent: IPlaybackEvent):
void
再生中のユーザーの再生動作に関する最新情報を報告します。
パラメーター
playbackEvent
デバイスで発生したばかりの再生イベント。
例
const playbackEvent: IPlaybackEvent = new PlaybackEventBuilder()
.playbackPositionMs(0)
.playbackState(PlaybackState.PLAYING)
.durationMs(2000)
.eventTimestamp(new Date())
.profileId(
new ProfileIdBuilder()
.id('myProfileId')
.idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
.build(),
)
...
// VODコンテンツの場合
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
...
// リニアコンテンツの場合(推奨)
.liveStationId(
new ContentIdBuilder()
.id('station_GVD')
.idNamespace(ContentIdNamespaces.NAMESPACE_GVD)
.build(),
)
...
// リニアコンテンツの場合(代替手段として、channelDescriptorを使用)
.channelDescriptor(
new ChannelDescriptorBuilder()
.majorNumber(0)
.minorNumber(1)
.identifier('channelID')
.build(),
)
...
.buildActiveEvent();
// イベントを送信します
ContentPersonalizationServer.reportNewPlaybackEvent(playbackEvent);
reportRefreshedPlaybackEvents()
reportRefreshedPlaybackEvents():
void
デバイス外で発生したユーザーの再生動作について、取得可能な最新情報があることを示します。
このAPIを使用する前に呼び出す必要があります。
reportNewCustomerListEntry()
reportNewCustomerListEntry(listType: CustomerListType, entry: ICustomerListEntry):
void
ユーザーが自分で管理するリストに新しいエントリを挿入したことを報告します。ユーザーのアクションによりデバイス上で挿入されたエントリのみが対象です。挿入時に報告されます。
パラメーター
listType
エントリの挿入先ユーザーリストのタイプ。
entry
ユーザーリストに追加されたエントリ。
例
const customerListEntry: ICustomerListEntry = new CustomerListEntryBuilder()
.addedTimestamp(new Date())
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
.profileId(
new ProfileIdBuilder()
.id('myProfileId1')
.idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
.build(),
)
.build();
// イベントを送信します
ContentPersonalizationServer.reportNewCustomerListEntry(
CustomerListType.WATCHLIST,
customerListEntry,
);
reportRemovedCustomerListEntry()
reportRemovedCustomerListEntry(listType: CustomerListType, entry: ICustomerListEntry):
void
ユーザーが自分で管理するリストからエントリを削除したことを報告します。ユーザーのアクションによりデバイスから削除されたエントリのみが対象です。削除時に報告されます。
パラメーター
listType
エントリの削除元であるユーザーリストのタイプ。
entry
ユーザーリストから削除されたエントリ。
例
const customerListEntry: ICustomerListEntry = new CustomerListEntryBuilder()
.addedTimestamp(new Date("2025-03-17T03:24:00"))
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
.profileId(
new ProfileIdBuilder()
.id('myProfileId1')
.idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
.build(),
)
.build();
// イベントを送信します
ContentPersonalizationServer.reportRemovedCustomerListEntry(
CustomerListType.WATCHLIST,
customerListEntry,
);
reportRefreshedCustomerList()
reportRefreshedCustomerList(listType: CustomerListType):
void
デバイス外でのアクションによりユーザー管理リストが変更されたため、ユーザー管理リストの更新版を取得する必要があることを示します。
このAPIを使用する前に呼び出す必要があります。
パラメーター
listType
変更されたユーザーリストのタイプ。
reportNewContentEntitlement()
reportNewContentEntitlement(entitlement: IContentEntitlement):
void
ユーザーが既存のコンテンツエンタイトルメントリストに新しい個別のコンテンツエンタイトルメントを挿入したことを報告します。定期購入型アイテムにまだ含まれていないエンタイトルメントのみが対象です。デバイスでのユーザーのアクションによって追加されたエンタイトルメントのみが対象です。挿入時に報告されます。
パラメーター
entitlement
新しいエンタイトルメント。
例
const entitlements: IContentEntitlement = new ContentEntitlementBuilder()
.acquisitionTimestamp(new Date())
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
.entitlementType(EntitlementType.RENTAL)
.expirationTimestamp(new Date("2025-12-17T03:24:00"))
.build();
// イベントを送信します
ContentPersonalizationServer.reportNewContentEntitlement(entitlements);
reportRemovedContentEntitlement()
reportRemovedContentEntitlement(entitlement: IContentEntitlement):
void
ユーザーの既存のコンテンツエンタイトルメントリストから、個別のコンテンツエンタイトルメントがなくなったことを報告します。定期購入型アイテムに含まれていないエンタイトルメントのみが対象です。デバイスでのアクションにより有効でなくなった、または有効期限が切れたエンタイトルメントのみが対象です。削除時に報告されます。
パラメーター
entitlement
削除されたエンタイトルメント。
例
const entitlements: IContentEntitlement = new ContentEntitlementBuilder()
.acquisitionTimestamp(new Date("2025-03-17T03:24:00"))
.contentId(
new ContentIdBuilder()
.id('content_CDF_ID')
.idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
.build(),
)
.entitlementType(EntitlementType.RENTAL)
.expirationTimestamp(new Date("2025-12-17T03:24:00"))
.build();
// イベントを送信します
ContentPersonalizationServer.reportRemovedContentEntitlement(entitlements);
reportRefreshedContentEntitlements()
reportRefreshedContentEntitlements():
void
デバイス外でのアクションにより個別のコンテンツエンタイトルメントが変更されたため、更新されたコンテンツエンタイトルメントリストを取得する必要があることを示します。
このAPIを使用する前に呼び出す必要があります。
Last updated: 2026年8月2日

