diff --git a/types/vast-client/index.d.ts b/types/vast-client/index.d.ts index 9886554e88..680e1e2dd8 100644 --- a/types/vast-client/index.d.ts +++ b/types/vast-client/index.d.ts @@ -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 { diff --git a/types/vast-client/vast-client-tests.ts b/types/vast-client/vast-client-tests.ts index eed1416c7a..aadf2c8370 100644 --- a/types/vast-client/vast-client-tests.ts +++ b/types/vast-client/vast-client-tests.ts @@ -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