diff options
Diffstat (limited to 'Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs')
-rw-r--r-- | Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs | 113 |
1 files changed, 113 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs b/Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs new file mode 100644 index 0000000..a303ea9 --- /dev/null +++ b/Client/Assembly-CSharp/GoogleMobileAds/Api/AdRequest.cs @@ -0,0 +1,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; + } + } +} |