as

Settings
Sign out
Notifications
Alexa
Amazonアプリストア
AWS
ドキュメント
Support
Contact Us
My Cases
開発
設計と開発
公開
リファレンス
サポート

IContentPersonalizationServer

IContentPersonalizationServer

コンテンツパーソナライゼーションサーバーのインターフェイス

メソッド

reportNewContentEntitlement()

reportNewContentEntitlement(entitlement): void

ユーザーが既存のコンテンツエンタイトルメントリストに新しい個別のコンテンツエンタイトルメントを挿入したことを報告します。定期購入型アイテムにまだ含まれていないエンタイトルメントのみが対象です。デバイスでのユーザーのアクションによって追加されたエンタイトルメントのみが対象です。挿入時に報告されます。

パラメーター

entitlement

IContentEntitlement

新しいエンタイトルメント。

戻り値

void

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);

reportNewContentInteraction()

reportNewContentInteraction(contentInteraction): void

ユーザーがコンテンツに反応したことを報告します(例:「好き」や「好きではない」を選択した、予告編を視聴した)。

パラメーター

contentInteraction

IContentInteraction

発生したコンテンツインタラクション。

戻り値

void

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);

reportNewCustomerListEntry()

reportNewCustomerListEntry(listType, entry): void

ユーザーが自分で管理するリストに新しいエントリを挿入したことを報告します。ユーザーのアクションによりデバイス上で挿入されたエントリのみが対象です。挿入時に報告されます。

パラメーター

listType

WATCHLIST

エントリの挿入先ユーザーリストのタイプ。

entry

ICustomerListEntry

ユーザーリストに追加されたエントリ。

戻り値

void

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,
);

reportNewPlaybackEvent()

reportNewPlaybackEvent(playbackEvent): void

再生中のユーザーの再生動作に関する最新情報を報告します。

パラメーター

playbackEvent

IPlaybackEvent

デバイスで発生したばかりの再生イベント。

戻り値

void

const playbackEvent: IPlaybackEvent = new PlaybackEventBuilder()
  .playbackPositionMs(0)
  .playbackState(PlaybackState.PLAYING)
  .durationMs(2000)
  .eventTimestamp(new Date())
  .contentId(
    new ContentIdBuilder()
      .id('content_CDF_ID')
      .idNamespace(ContentIdNamespaces.NAMESPACE_CDF_ID)
      .build(),
  )
  .channelDescriptor(
    new ChannelDescriptorBuilder()
      .majorNumber(0)
      .minorNumber(1)
      .identifier('channelID')
      .build(),
  )
  .profileId(
    new ProfileIdBuilder()
      .id('myProfileId')
      .idNamespace(ProfileIdNamespaces.NAMESPACE_APP_INTERNAL)
      .build(),
  )
  .buildActiveEvent();

// イベントを送信します
ContentPersonalizationServer.reportNewPlaybackEvent(playbackEvent);

reportRefreshedContentEntitlements()

reportRefreshedContentEntitlements(): void

デバイス外でのアクションにより個別のコンテンツエンタイトルメントが変更されたため、更新されたコンテンツエンタイトルメントリストを取得する必要があることを示します。

このAPIを使用する前に、setContentEntitlementsHandlerForComponentを呼び出す必要があります。

戻り値

void


reportRefreshedCustomerList()

reportRefreshedCustomerList(listType): void

デバイス外でのアクションによりユーザー管理リストが変更されたため、ユーザー管理リストの更新版を取得する必要があることを示します。

このAPIを使用する前に、setCustomerListEntriesHandlerForComponentを呼び出す必要があります。

パラメーター

listType

WATCHLIST

変更されたユーザーリストのタイプ。

戻り値

void


reportRefreshedPlaybackEvents()

reportRefreshedPlaybackEvents(): void

デバイス外で発生したユーザーの再生動作について、取得可能な最新情報があることを示します。

このAPIを使用する前に、setPlaybackEventsHandlerForComponentを呼び出す必要があります。

戻り値

void


reportRemovedContentEntitlement()

reportRemovedContentEntitlement(entitlement): void

ユーザーの既存のコンテンツエンタイトルメントリストから、個別のコンテンツエンタイトルメントがなくなったことを報告します。定期購入型アイテムに含まれていないエンタイトルメントのみが対象です。デバイスでのアクションにより有効でなくなった、または有効期限が切れたエンタイトルメントのみが対象です。削除時に報告されます。

パラメーター

entitlement

IContentEntitlement

削除されたエンタイトルメント。

戻り値

void

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);

reportRemovedCustomerListEntry()

reportRemovedCustomerListEntry(listType, entry): void

ユーザーが自分で管理するリストからエントリを削除したことを報告します。ユーザーのアクションによりデバイスから削除されたエントリのみが対象です。削除時に報告されます。

パラメーター

listType

WATCHLIST

エントリの削除元であるユーザーリストのタイプ。

entry

ICustomerListEntry

ユーザーリストから削除されたエントリ。

戻り値

void

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,
);

setContentEntitlementsHandler()

setContentEntitlementsHandler(contentEntitlementsHandler): void

パラメーター

contentEntitlementsHandler

IContentEntitlementsHandler

戻り値

void

廃止

このメソッドは廃止されました。代わりにsetContentEntitlementsHandlerForComponentを使用してください。


setContentEntitlementsHandlerForComponent()

setContentEntitlementsHandlerForComponent(contentEntitlementsHandler, component): void

コマンドに応答してコンテンツエンタイトルメントデータを提供する、特定のコンポーネントのハンドラーを設定します。

パラメーター

contentEntitlementsHandler

IContentEntitlementsHandler

コンテンツエンタイトルメントに関するコマンドのハンドラー。

component

IComponentInstance

ハンドラーを設定する対象のコンポーネントインスタンス。

戻り値

void

import {
  ContentPersonalizationServer,
  CustomerListType,
  IContentEntitlementsHandler,
  IContentEntitlementsProvider,
  ICustomerListEntriesHandler,
  ...
} from "@amazon-devices/kepler-content-personalization";

...

// ハンドラー
const contentEntitlementsHandler: IContentEntitlementsHandler = {
  getAllContentEntitlements: (
    contentEntitlementsProvider: IContentEntitlementsProvider,
  ) => {
    contentEntitlementsProvider.addContentEntitlementChunk(<エンタイトルメントを追加>);
    contentEntitlementsProvider.commit();
  },
};

...

// ヘッドレスサービス
onStart(componentInstance: IComponentInstance): Promise<void> {
  ContentPersonalizationServer.setContentEntitlementsHandlerForComponent(
    contentEntitlementsHandler,
    componentInstance,
  );

  // ここでほかのハンドラーを設定します。「SubscriptionEntitlementServer」も対象です
  ...

  return Promise.resolve();
}

setCustomerListEntriesHandler()

setCustomerListEntriesHandler(customerListEntriesHandler): void

パラメーター

customerListEntriesHandler

ICustomerListEntriesHandler

戻り値

void

廃止

このメソッドは廃止されました。代わりにsetCustomerListEntriesHandlerForComponentを使用してください。


setCustomerListEntriesHandlerForComponent()

setCustomerListEntriesHandlerForComponent(customerListEntriesHandler, component): void

コマンドに応答してユーザーリストエントリデータを提供する、特定のコンポーネントのハンドラーを設定します。

パラメーター

customerListEntriesHandler

ICustomerListEntriesHandler

ユーザーリストに関するコマンドのハンドラー。

component

IComponentInstance

ハンドラーを設定する対象のコンポーネントインスタンス。

戻り値

void

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): void

パラメーター

playbackEventsHandler

IPlaybackEventsHandler

戻り値

void

廃止

このメソッドは廃止されました。代わりにsetPlaybackEventsHandlerForComponentを使用してください。


setPlaybackEventsHandlerForComponent()

setPlaybackEventsHandlerForComponent(playbackEventsHandler, component): void

コマンドに応答して再生イベントデータを提供する、特定のコンポーネントのハンドラーを設定します。

パラメーター

playbackEventsHandler

IPlaybackEventsHandler

再生イベントに関するコマンドのハンドラー。

component

IComponentInstance

ハンドラーを設定する対象のコンポーネントインスタンス。

戻り値

void

import {
  ContentPersonalizationServer,
  CustomerListType,
  IContentEntitlementsHandler,
  IContentEntitlementsProvider,
  ICustomerListEntriesHandler,
  ...
} from "@amazon-devices/kepler-content-personalization";

...

// ハンドラー
const playbackEventsHandler: IPlaybackEventsHandler = {
  getPlaybackEventsSince: (
    sinceTimestamp: Date,
    playbackEventsProvider: IPlaybackEventsProvider,
  ) => {
    playbackEventsProvider.addPlaybackEventChunk(<再生イベントを追加>);
    playbackEventsProvider.commit();
  },
};
...

// ヘッドレスサービス
onStart(componentInstance: IComponentInstance): Promise<void> {
  ContentPersonalizationServer.setPlaybackEventsHandlerForComponent(
    playbackEventsHandler,
    componentInstance,
  );

  // ここでほかのハンドラーを設定します。「SubscriptionEntitlementServer」も対象です
  ...

  return Promise.resolve();
}

Last updated: 2025年10月2日