/// <summary> /// /// </summary> /// <param name="prjSettings">A ProjectSettings instance containing the ProjectId and API keys</param> public KeenClient(IProjectSettings prjSettings) { // Preconditions if (null == prjSettings) throw new KeenException("An IProjectSettings instance is required."); if (string.IsNullOrWhiteSpace(prjSettings.ProjectId)) throw new KeenException("A Project ID is required."); if ((string.IsNullOrWhiteSpace(prjSettings.MasterKey) && string.IsNullOrWhiteSpace(prjSettings.WriteKey))) throw new KeenException("A Master or Write API key is required."); if (string.IsNullOrWhiteSpace(prjSettings.KeenUrl)) throw new KeenException("A URL for the server address is required."); _prjSettings = prjSettings; // The EventCollection and Event interface normally should not need to // be set by callers, so the default implementation is set up here. Users // may override these by injecting an implementation via the property. EventCollection = new EventCollection(_prjSettings); Event = new Event(_prjSettings); Queries = new Queries(_prjSettings); }