Пример #1
0
		public string ExportRaw(ClientConfiguration clientConfiguration, Date from, Date to, string[] events = null)
		{
			try
			{
				var uri = MixPanelEndpointConfiguration.RawExportUrl;

				var parameterDictionary = new Dictionary<string, string>();

				parameterDictionary.Add(FromDateParamName, from.ToString());
				parameterDictionary.Add(ToDateParamName, to.ToString());
				if (events != null
				    && events.Any())
					parameterDictionary.Add(EventParamName, StringifyEvents(events));

				var callingUri =
					new Uri(uri.ToString() + "?" + string.Join("&", parameterDictionary.Select(x => x.Key + "=" + x.Value)));

				var webClientResponse = _webClient.QueryUri(callingUri,
				                                            new BasicAuthentication { UserName = clientConfiguration.Secret });

				return webClientResponse;
			}
			catch (WebException ex)
			{
				TryHandleWebException(ex);
				throw new MixPanelClientException(ex);
			}
			catch (Exception ex)
			{
				throw new MixPanelClientException(ex);
			}
		}
Пример #2
0
		public bool VerifyCredentials(ClientConfiguration clientConfiguration)
		{
			try
			{
				ExportRaw(clientConfiguration, new Date(2012, 1, 1), new Date(2012, 1, 2));
			}
			catch
			{
				return false;
			}

			return true;
		}