public ApnConfig(string p8PrivateKey, string p8PrivateKeyId, string teamId, string topic, ApnServerType apnServerType) { P8PrivateKey = p8PrivateKey ?? throw new ArgumentNullException(nameof(p8PrivateKey)); P8PrivateKeyId = p8PrivateKeyId ?? throw new ArgumentNullException(nameof(p8PrivateKeyId)); TeamId = teamId ?? throw new ArgumentNullException(nameof(teamId)); Topic = topic ?? throw new ArgumentNullException(nameof(topic)); serverType = apnServerType; }
/// <summary> /// Initialize sender /// </summary> /// <param name="p8privateKey">p8 certificate string</param> /// <param name="privateKeyId">10 digit p8 certificate id. Usually a part of a downloadable certificate filename</param> /// <param name="teamId">Apple 10 digit team id</param> /// <param name="appBundleIdentifier">App slug / bundle name</param> /// <param name="server">Development or Production server</param> public ApnSender(string p8privateKey, string p8privateKeyId, string teamId, string appBundleIdentifier, ApnServerType server) { this.p8privateKey = p8privateKey; this.p8privateKeyId = p8privateKeyId; this.teamId = teamId; this.server = server; this.appBundleIdentifier = appBundleIdentifier; this.jwtToken = new Lazy <string>(() => CreateJwtToken()); this.http = new Lazy <HttpClient>(() => new HttpClient()); }