2017-07-25 12 views

回答

0

好的,讓它工作。代碼是在斯卡拉,但應該在Java中相同。

implicit val batch = new BatchRequest(FacebookApi.context) 
apiNodeList.asScala.map(getInsights) 

def getInsights(node: Ad)(implicit data: InsightData, batch: BatchRequest) = { 
    node.getInsights 
     .setBreakdowns(data.breakdowns) 
     .setDatePreset(data.datePreset.toString) 
     .setFields(data.fields) 
     .setActionAttributionWindows(data.attributionWindow) 
     .setTimeIncrement(data.timeIncrement) 
     .addToBatch(batch) 
} 

val result = batch.execute()