summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs
blob: a303ea91179328582929a4a19eb1fee7346dec20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
using System;
using System.Collections.Generic;
using GoogleMobileAds.Api.Mediation;

namespace GoogleMobileAds.Api
{
	public class AdRequest
	{
		public List<string> TestDevices { get; private set; }

		public HashSet<string> Keywords { get; private set; }

		public DateTime? Birthday { get; private set; }

		public Gender? Gender { get; private set; }

		public bool? TagForChildDirectedTreatment { get; private set; }

		public Dictionary<string, string> Extras { get; private set; }

		public List<MediationExtras> MediationExtras { get; private set; }

		public const string Version = "3.17.0";

		public const string TestDeviceSimulator = "SIMULATOR";

		public class Builder
		{
			internal List<string> TestDevices { get; private set; }

			internal HashSet<string> Keywords { get; private set; }

			internal DateTime? Birthday { get; private set; }

			internal Gender? Gender { get; private set; }

			internal bool? ChildDirectedTreatmentTag { get; private set; }

			internal Dictionary<string, string> Extras { get; private set; }

			internal List<MediationExtras> MediationExtras { get; private set; }

			public Builder()
			{
				this.TestDevices = new List<string>();
				this.Keywords = new HashSet<string>();
				this.Birthday = null;
				this.Gender = null;
				this.ChildDirectedTreatmentTag = null;
				this.Extras = new Dictionary<string, string>();
				this.MediationExtras = new List<MediationExtras>();
			}

			public AdRequest.Builder AddKeyword(string keyword)
			{
				this.Keywords.Add(keyword);
				return this;
			}

			public AdRequest.Builder AddTestDevice(string deviceId)
			{
				this.TestDevices.Add(deviceId);
				return this;
			}

			public AdRequest Build()
			{
				return new AdRequest(this);
			}

			public AdRequest.Builder SetBirthday(DateTime birthday)
			{
				this.Birthday = new DateTime?(birthday);
				return this;
			}

			public AdRequest.Builder SetGender(Gender gender)
			{
				this.Gender = new Gender?(gender);
				return this;
			}

			public AdRequest.Builder AddMediationExtras(MediationExtras extras)
			{
				this.MediationExtras.Add(extras);
				return this;
			}

			public AdRequest.Builder TagForChildDirectedTreatment(bool tagForChildDirectedTreatment)
			{
				this.ChildDirectedTreatmentTag = new bool?(tagForChildDirectedTreatment);
				return this;
			}

			public AdRequest.Builder AddExtra(string key, string value)
			{
				this.Extras.Add(key, value);
				return this;
			}
		}

		private AdRequest(AdRequest.Builder builder)
		{
			this.TestDevices = new List<string>(builder.TestDevices);
			this.Keywords = new HashSet<string>(builder.Keywords);
			this.Birthday = builder.Birthday;
			this.Gender = builder.Gender;
			this.TagForChildDirectedTreatment = builder.ChildDirectedTreatmentTag;
			this.Extras = new Dictionary<string, string>(builder.Extras);
			this.MediationExtras = builder.MediationExtras;
		}
	}
}