Пример #1
0
 /// <summary>
 /// Default constructor.
 /// </summary>
 /// <param name="apiKey">Your OneSignal API key</param>
 /// <param name="apiUri">API uri (default is "https://onesignal.com/api/v1")</param>
 public OneSignalClient(string apiKey,
                        string apiUri             = "https://onesignal.com/api/v1",
                        ProxyOptions ProxyOptions = null)
 {
     this.Devices       = new DevicesRequest(apiKey, apiUri, ProxyOptions);
     this.Notifications = new NotificationsRequest(apiKey, apiUri, ProxyOptions);
 }
Пример #2
0
        /// <summary>
        /// Default constructor.
        /// </summary>
        /// <param name="apiKey">Your OneSignal API key</param>
        /// <param name="apiUri">API uri (https://onesignal.com/api/v1/notifications)</param>
        protected WebAPIRequest(string apiKey, string apiUri, ProxyOptions proxyOptions = null)
        {
            ApiKey     = apiKey;
            RestClient = new RestClient(apiUri);

            if (null != proxyOptions)
            {
                WebProxy proxy = new WebProxy(proxyOptions.Url, true)
                {
                    Credentials = new NetworkCredential(proxyOptions.UserName, proxyOptions.Password)
                };
                RestClient.Proxy = proxy;
            }
        }