Exemple #1
0
 public CountryResponse(
     Continent?continent = null,
     Country?country     = null,
     [Parameter("maxmind")] Model.MaxMind?maxMind = null,
     [Parameter("registered_country")] Country?registeredCountry = null,
     [Parameter("represented_country")] RepresentedCountry?representedCountry = null,
     [Parameter("traits", true)] Traits?traits = null
     ) : base(continent, country, maxMind, registeredCountry, representedCountry, traits)
 {
 }
Exemple #2
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AbstractCountryResponse" /> class.
 /// </summary>
 protected AbstractCountryResponse(
     Continent?continent                   = null,
     Country?country                       = null,
     Model.MaxMind?maxMind                 = null,
     Country?registeredCountry             = null,
     RepresentedCountry?representedCountry = null,
     Traits?traits = null)
 {
     Continent          = continent ?? new Continent();
     Country            = country ?? new Country();
     MaxMind            = maxMind ?? new Model.MaxMind();
     RegisteredCountry  = registeredCountry ?? new Country();
     RepresentedCountry = representedCountry ?? new RepresentedCountry();
     Traits             = traits ?? new Traits();
 }
Exemple #3
0
 public CityResponse(
     City?city           = null,
     Continent?continent = null,
     Country?country     = null,
     Location?location   = null,
     [Parameter("maxmind")] Model.MaxMind?maxMind = null,
     Postal?postal = null,
     [Parameter("registered_country")] Country?registeredCountry = null,
     [Parameter("represented_country")] RepresentedCountry?representedCountry = null,
     IEnumerable <Subdivision>?subdivisions    = null,
     [Parameter("traits", true)] Traits?traits = null)
     : base(
         city, continent, country, location, maxMind, postal, registeredCountry, representedCountry, subdivisions,
         traits)
 {
 }
 public EnterpriseResponse(
     City?city                                = null,
     Continent?continent                      = null,
     Country?country                          = null,
     Location?location                        = null,
     Model.MaxMind?maxMind                    = null,
     Postal?postal                            = null,
     Country?registeredCountry                = null,
     RepresentedCountry?representedCountry    = null,
     IReadOnlyList <Subdivision>?subdivisions = null,
     Traits?traits                            = null)
     : base(
         city, continent, country, location, maxMind, postal, registeredCountry, representedCountry, subdivisions,
         traits)
 {
 }
Exemple #5
0
 /// <summary>
 ///     Constructor
 /// </summary>
 public InsightsResponse(
     City?city                              = null,
     Continent?continent                    = null,
     Country?country                        = null,
     Location?location                      = null,
     Model.MaxMind?maxMind                  = null,
     Postal?postal                          = null,
     Country?registeredCountry              = null,
     RepresentedCountry?representedCountry  = null,
     IEnumerable <Subdivision>?subdivisions = null,
     Traits?traits                          = null)
     : base(
         city, continent, country, location, maxMind, postal, registeredCountry, representedCountry, subdivisions,
         traits)
 {
 }
Exemple #6
0
        private void SetupListener(Continent?cont)
        {
            if (_listener != null)
            {
                _listener.Dispose();
                _listener = null;
                Log("Unsubscribed from : {0}", _activeCont.Value.ToString());
                _activeCont = null;
            }

            SetupEnablement();

            if (!cont.HasValue)
            {
                return;
            }

            _listener = _listenerBld(new ContinentalSubscriptionRequest {
                Continent = cont.Value
            });
            _activeCont = cont;

            SetupEnablement();

            _listener.OnMessage += msg => {
                Log("Got notification from {0} ({1})at {2} about country={3}",
                    msg.Sender, msg.SenderSseStreamId, I18n.Localize(msg.SentAt, DateTimeFormat.YMDhms),
                    msg.Country.ToString());
            };
            _listener.OnError += (_, rs) => {
                if (rs == ConnectionReadyState.CLOSED)
                {
                    //f.e. httpstatus rejected

                    Log("Permanent connection error - unsubscribing");
                    SetupListener(null);
                    return;
                }

                Log("Temporary connection error - reconnecting");
            };

            _listener.OnConnOpen         += () => Log("Connected");
            _listener.OnStreamIdAssigned += x => Log("Subscribed as {0}", x);

            Log("Requested subscription to {0}", cont.Value.ToString());
        }
Exemple #7
0
 /// <summary>
 ///     Initializes a new instance of the <see cref="AbstractCityResponse" /> class.
 /// </summary>
 protected AbstractCityResponse(
     City?city                                = null,
     Continent?continent                      = null,
     Country?country                          = null,
     Location?location                        = null,
     Model.MaxMind?maxMind                    = null,
     Postal?postal                            = null,
     Country?registeredCountry                = null,
     RepresentedCountry?representedCountry    = null,
     IReadOnlyList <Subdivision>?subdivisions = null,
     Traits?traits                            = null)
     : base(continent, country, maxMind, registeredCountry, representedCountry, traits)
 {
     City         = city ?? new City();
     Location     = location ?? new Location();
     Postal       = postal ?? new Postal();
     Subdivisions = subdivisions ?? new List <Subdivision>().AsReadOnly();
 }