Merge pull request #18141 from jgainfort/fix/vast-client-vastad

Fix/vast-client support for VastAd.creatives
This commit is contained in:
Wesley Wigham
2017-07-17 15:04:52 -07:00
committed by GitHub
2 changed files with 51 additions and 16 deletions
+44 -16
View File
@@ -231,9 +231,37 @@ export interface VastError {
ERRORCODE: string;
}
export interface VastCreative {
id: string;
adId: string;
trackingEvents: VastTrackingEvents;
apiFramework: any;
sequence: any;
type: string;
}
export interface VastCreativeLinear extends VastCreative {
adParameters: any;
duration: number;
icons: string[];
mediaFiles: VastMediaFile[];
skipDelay: boolean;
videoClickThroughURLTemplate: string;
videoClickTrackingURLTemplates: string[];
videoCustomClickURLTempaltes: string[];
}
export interface VastCreativeNonLinear extends VastCreative {
variations: VastNonLinearAd[];
}
export interface VastCreativeCompanion extends VastCreative {
variations: VastCompanionAd[];
}
export interface VastAd {
advertiser: any;
creatives: VastCreativeLinear | VastCreativeCompanion[];
creatives: VastCreative[];
description: string;
errorURLTemplates: string[];
extensions: VastAdExtension[];
@@ -266,22 +294,22 @@ export interface VastAdChildAttributes {
name: string;
}
export interface VastCreativeLinear {
adParameters: any;
duration: number;
icons: string[];
mediaFiles: VastMediaFile[];
skipDelay: boolean;
trackingEvents: VastTrackingEvents;
export interface VastNonLinearAd {
nonLinearClickTrackingURLTemplates: string[];
nonLinearClickThroughURLTemplate: string;
adParameters: string;
type: string;
videoClickThroughURLTemplate: string;
videoClickTrackingURLTemplates: string[];
videoCustomClickURLTempaltes: string[];
}
export interface VastCreativeCompanion {
type: string;
variations: VastCompanionAd[];
iframeResource: string;
htmlResource: string;
id: string;
width: string;
height: string;
expandedWidth: string;
expandedHeight: string;
scalablle: boolean;
maintainAspectRatio: boolean;
minSuggestedDuration: number;
apiFramework: any;
}
export interface VastCompanionAd {
+7
View File
@@ -5,6 +5,13 @@ function cb(response: DMVAST.VastResponse, error: Error): void {
if (error) return;
// process the VAST response
const ads: DMVAST.VastAd[] = response.ads;
const linearCreative = response.ads[0].creatives.filter(creative => {
return creative.type === 'linear';
});
if (linearCreative && linearCreative.length > 0) {
const creative = linearCreative[0] as DMVAST.VastCreativeLinear;
const mediaFiles = creative.mediaFiles;
}
}
// CLIENT