using System; using System.Collections.Generic; using GoogleMobileAds.Api.Mediation; namespace GoogleMobileAds.Api { public class AdRequest { public List TestDevices { get; private set; } public HashSet Keywords { get; private set; } public DateTime? Birthday { get; private set; } public Gender? Gender { get; private set; } public bool? TagForChildDirectedTreatment { get; private set; } public Dictionary Extras { get; private set; } public List MediationExtras { get; private set; } public const string Version = "3.17.0"; public const string TestDeviceSimulator = "SIMULATOR"; public class Builder { internal List TestDevices { get; private set; } internal HashSet Keywords { get; private set; } internal DateTime? Birthday { get; private set; } internal Gender? Gender { get; private set; } internal bool? ChildDirectedTreatmentTag { get; private set; } internal Dictionary Extras { get; private set; } internal List MediationExtras { get; private set; } public Builder() { this.TestDevices = new List(); this.Keywords = new HashSet(); this.Birthday = null; this.Gender = null; this.ChildDirectedTreatmentTag = null; this.Extras = new Dictionary(); this.MediationExtras = new List(); } 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(builder.TestDevices); this.Keywords = new HashSet(builder.Keywords); this.Birthday = builder.Birthday; this.Gender = builder.Gender; this.TagForChildDirectedTreatment = builder.ChildDirectedTreatmentTag; this.Extras = new Dictionary(builder.Extras); this.MediationExtras = builder.MediationExtras; } } }