Line data Source code
1 : import 'dart:convert';
2 :
3 : ///VAST ad request configuration.
4 : class VastAdsRequest {
5 : /// Specifies a VAST document to be used as
6 : /// the ads response instead of making a request
7 : /// via an ad tag URL. This can be useful for debugging
8 : /// and other situations where a VAST
9 : /// response is already available.
10 :
11 : final String? adsResponse;
12 :
13 : /// URL for VAST file.
14 :
15 : final String? adTagUrl;
16 :
17 : /// Creates a new [VastAdsRequest] instance.
18 : ///
19 : /// [adsResponse] - Specifies a VAST document to be used as the ads response.
20 : /// [adTagUrl] - URL for VAST file.
21 0 : VastAdsRequest({
22 : this.adsResponse,
23 : this.adTagUrl,
24 : });
25 :
26 : /// Converts the [VastAdsRequest] to a map.
27 : ///
28 : /// Returns a [Map] representation of this object.
29 0 : Map<String, dynamic> toMap() {
30 0 : return {
31 0 : 'adsResponse': adsResponse,
32 0 : 'adTagUrl': adTagUrl,
33 : };
34 : }
35 :
36 : /// Creates a [VastAdsRequest] from a map.
37 : ///
38 : /// [map] - The map to create the instance from.
39 0 : factory VastAdsRequest.fromMap(Map<String, dynamic> map) {
40 0 : return VastAdsRequest(
41 0 : adsResponse: map['adsResponse'],
42 0 : adTagUrl: map['adTagUrl'],
43 : );
44 : }
45 :
46 : /// Converts the [VastAdsRequest] to a JSON string.
47 : ///
48 : /// Returns a JSON string representation of this object.
49 0 : String toJson() => json.encode(toMap());
50 :
51 : /// Creates a [VastAdsRequest] from a JSON string.
52 : ///
53 : /// [source] - The JSON string to create the instance from.
54 0 : factory VastAdsRequest.fromJson(String source) =>
55 0 : VastAdsRequest.fromMap(json.decode(source));
56 : }
|