요약
상속된 멤버
코드 샘플
추천 항목 목록 생성
local RecommendationService = game:GetService("RecommendationService")
-- 추천 목록 생성을 위한 요청 정의
local request: GenerateRecommendationItemListRequest = {
ConfigName = "MaximizeEngagement",
LocationId = "Lobby",
PageSize = 10
-- 주의: 서버 스크립트를 위해 CustomContexts.UserId를 주석 해제하고 설정하세요.
-- 로컬 스크립트에서는 설정할 필요 없습니다.
-- CustomContexts = {
-- ["UserId"] = tostring(player.UserId),
-- }
}
-- GenerateItemListAsync를 호출하여 추천 페이지 가져오기
local success, recommendationPages = pcall(function()
return RecommendationService:GenerateItemListAsync(request)
end)
if success then
-- 추천 항목의 현재 페이지 가져오기
local currentPage = recommendationPages:GetCurrentPage()
for _, item in ipairs(currentPage) do
print("ItemId: " .. item.ItemId)
print(" ReferenceId: " .. item.ReferenceId)
print(" TracingId: " .. item.TracingId)
end
else
warn("RecommendationService 오류: " .. tostring(recommendationPages))
end
--[[ 페이지 내 각 항목의 반환 데이터 형식
{
"ItemId": string,
"ReferenceId": string,
"TracingId": string,
"Creator": {
"CreatorId": number,
"CreatorType": Enum.CreatorType,
}?,
"Attributes": {
{
"AssetId": number?,
"Text": string?,
"Description": string?,
"SeekStartTime": number?,
"SeekEndTime": number?,
"TrimStartTime": number?,
"TrimEndTime": number?
}
}?,
"CustomTags": { string }?
}
--]]