Merged PR 6174: Merge feature/remove-snake-case to appcenter

Seems like logs are received properly by ingestion. I still need to test that they are actually correct, though.

Related work items: #22552
This commit is contained in:
Alexander Chocron 2017-11-08 23:54:25 +00:00 коммит произвёл Guillaume Perrot
Родитель 10477023ec a3b567f26e
Коммит e3e746752d
73 изменённых файлов: 4536 добавлений и 2402 удалений

Просмотреть файл

@ -1,9 +1,9 @@
{
"dependencies": {
"Microsoft.AppCenter.Analytics": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Crashes": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Distribute": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Push": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Analytics": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Crashes": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Distribute": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Push": "1.0.0-r0003-6ce5d1f",
"Microsoft.NETCore.UniversalWindowsPlatform": "5.2.2",
"Xamarin.Forms": "2.4.0.38779"
},

Просмотреть файл

@ -1,9 +1,9 @@
{
"dependencies": {
"Microsoft.AppCenter.Analytics": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Crashes": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Distribute": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Push": "1.0.0-r0001-eda95fe",
"Microsoft.AppCenter.Analytics": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Crashes": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Distribute": "1.0.0-r0003-6ce5d1f",
"Microsoft.AppCenter.Push": "1.0.0-r0003-6ce5d1f",
"NETStandard.Library": "1.6.1",
"Xamarin.Forms": "2.4.0.38779"
},

Просмотреть файл

@ -234,7 +234,7 @@ namespace Microsoft.AppCenter
{
_applicationSettings = _applicationSettingsFactory?.CreateApplicationSettings() ?? new DefaultApplicationSettings();
LogSerializer.AddLogType(StartServiceLog.JsonIdentifier, typeof(StartServiceLog));
LogSerializer.AddLogType(CustomPropertiesLog.JsonIdentifier, typeof(CustomPropertiesLog));
LogSerializer.AddLogType(CustomPropertyLog.JsonIdentifier, typeof(CustomPropertyLog));
}
}
@ -287,7 +287,7 @@ namespace Microsoft.AppCenter
AppCenterLog.Error(AppCenterLog.LogTag, "Custom properties may not be null or empty");
return;
}
var customPropertiesLog = new CustomPropertiesLog();
var customPropertiesLog = new CustomPropertyLog();
customPropertiesLog.Properties = customProperties.Properties;
_channel.EnqueueAsync(customPropertiesLog);
}

Просмотреть файл

@ -1,4 +1,5 @@
using System;
using Microsoft.AppCenter.Ingestion.Models;
using System;
using System.Collections.Generic;
using System.Text.RegularExpressions;
@ -8,94 +9,85 @@ namespace Microsoft.AppCenter
{
private static readonly Regex KeyPattern = new Regex("^[a-zA-Z][a-zA-Z0-9]*$");
private const int MaxCustomPropertiesCount = 60;
private const int MaxCustomPropertiesKeyLength = 128;
private const int MaxCustomPropertiesStringValueLength = 128;
internal IList<CustomProperty> Properties { get; } = new List<CustomProperty>();
internal Dictionary<string, object> Properties { get; } = new Dictionary<string, object>();
private CustomProperties SetProperty(CustomProperty property)
{
try
{
property.Validate();
}
catch (ValidationException e)
{
AppCenterLog.Error(AppCenterLog.LogTag, e.Message);
return this;
}
if (Properties.Count >= MaxCustomPropertiesCount)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom properties cannot contain more than " + MaxCustomPropertiesCount + " items.");
return this;
}
CustomProperty existingPropertyToRemove = null;
foreach (var existingProperty in Properties)
{
if (existingProperty.Name == property.Name)
{
existingPropertyToRemove = existingProperty;
break;
}
}
if (existingPropertyToRemove != null)
{
AppCenterLog.Warn(AppCenterLog.LogTag, "Custom property \"" + property.Name + "\" is already set or cleared and will be overwritten.");
Properties.Remove(existingPropertyToRemove);
}
Properties.Add(property);
return this;
}
public CustomProperties PlatformSet(string key, string value)
{
if (ValidateKey(key))
{
if (value == null)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" value cannot be null, did you mean to call clear?");
}
else if (value.Length > MaxCustomPropertiesStringValueLength)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" value length cannot be longer than " + MaxCustomPropertiesStringValueLength + " characters.");
}
else
{
Properties[key] = value;
}
}
return this;
return SetProperty(new StringProperty(key, value));
}
public CustomProperties PlatformSet(string key, DateTime value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, DateTime value)
{
return SetProperty(new DateTimeProperty(key, value));
}
public CustomProperties PlatformSet(string key, int value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, int value)
{
return SetProperty(new NumberProperty(key, value));
}
public CustomProperties PlatformSet(string key, long value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, long value)
{
return SetProperty(new NumberProperty(key, value));
}
public CustomProperties PlatformSet(string key, float value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, float value)
{
return SetProperty(new NumberProperty(key, value));
}
public CustomProperties PlatformSet(string key, double value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, double value)
{
return SetProperty(new NumberProperty(key, value));
}
public CustomProperties PlatformSet(string key, decimal value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, decimal value)
{
return SetProperty(new NumberProperty(key, value));
}
public CustomProperties PlatformSet(string key, bool value) => SetObject(key, value);
public CustomProperties PlatformSet(string key, bool value)
{
return SetProperty(new BooleanProperty(key, value));
}
public CustomProperties PlatformClear(string key)
{
if (ValidateKey(key))
{
/* Null value means that key marked to clear. */
Properties[key] = null;
}
return this;
}
private CustomProperties SetObject(string key, object value)
{
if (ValidateKey(key))
{
if (value == null)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" value cannot be null, did you mean to call clear?");
}
else
{
Properties[key] = value;
}
}
return this;
}
private bool ValidateKey(string key)
{
if (key == null || !KeyPattern.IsMatch(key))
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" must match \"" + KeyPattern + "\"");
return false;
}
if (key.Length > MaxCustomPropertiesKeyLength)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" key length cannot be longer than " + MaxCustomPropertiesKeyLength + " characters.");
return false;
}
if (Properties.ContainsKey(key))
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom property \"" + key + "\" is already set or cleared and will be overridden.");
}
else if (Properties.Count >= MaxCustomPropertiesCount)
{
AppCenterLog.Error(AppCenterLog.LogTag, "Custom properties cannot contain more than " + MaxCustomPropertiesCount + " items.");
return false;
}
return true;
return SetProperty(new ClearProperty(key));
}
}
}

Просмотреть файл

@ -11,7 +11,7 @@ namespace Microsoft.AppCenter.Ingestion.Http
public sealed class IngestionHttp : IIngestion
{
internal const string DefaultBaseUrl = "https://in.mobile.azure.com";
internal const string ApiVersion = "/logs?api_version=1.0.0-preview20160914";
internal const string ApiVersion = "/logs?api-version=1.0.0";
internal const string AppSecret = "App-Secret";
internal const string InstallId = "Install-ID";

Просмотреть файл

@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Boolean property.
/// </summary>
[JsonObject(JsonIdentifier)]
public partial class BooleanProperty : CustomProperty
{
internal const string JsonIdentifier = "boolean";
/// <summary>
/// Initializes a new instance of the BooleanProperty class.
/// </summary>
public BooleanProperty() { }
/// <summary>
/// Initializes a new instance of the BooleanProperty class.
/// </summary>
/// <param name="value">Boolean property value.</param>
public BooleanProperty(string name, bool value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets boolean property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public bool Value { get; set; }
public override object GetValue()
{
return Value;
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.AppCenter.Ingestion.Models.Serialization;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Clear an existing property.
/// </summary>
[JsonObject(JsonIdentifier)]
public partial class ClearProperty : CustomProperty
{
internal const string JsonIdentifier = "clear";
/// <summary>
/// Initializes a new instance of the ClearProperty class.
/// </summary>
public ClearProperty() { }
/// <summary>
/// Initializes a new instance of the ClearProperty class.
/// </summary>
public ClearProperty(string name)
: base(name)
{
}
public override object GetValue()
{
return null;
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -1,176 +0,0 @@
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Microsoft.AppCenter.Ingestion.Models
{
/// <summary>
/// The custom properties log model.
/// </summary>
[JsonObject(JsonIdentifier)]
public class CustomPropertiesLog : Log
{
internal const string JsonIdentifier = "custom_properties";
private const string PropertyType = "type";
private const string PropertyName = "name";
private const string PropertyValue = "value";
private const string PropertyTypeClear = "clear";
private const string PropertyTypeBoolean = "boolean";
private const string PropertyTypeNumber = "number";
private const string PropertyTypeDatetime = "date_time";
private const string PropertyTypeString = "string";
/// <summary>
/// Initializes a new instance of the Log class.
/// </summary>
public CustomPropertiesLog()
{
Properties = new Dictionary<string, object>();
}
/// <summary>
/// Key/value pair properties.
/// </summary>
/// <remarks>JsonConverter attribute not supported here.</remarks>
[JsonIgnore]
public IDictionary<string, object> Properties { get; set; }
[JsonProperty(PropertyName = "properties")]
internal JArray JsonProperties
{
get { return WriteProperties(Properties); }
set { Properties = ReadProperties(value); }
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Properties == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Properties));
}
}
private static JArray WriteProperties(IDictionary<string, object> value)
{
if (value == null)
{
return null;
}
var properties = new JArray();
foreach (var property in value)
{
properties.Add(WriteProperty(property.Key, property.Value));
}
return properties;
}
private static JObject WriteProperty(string key, object value)
{
var property = new JObject();
property.Add(PropertyName, key);
if (value == null)
{
property.Add(PropertyType, PropertyTypeClear);
}
else
{
var typeCode = Convert.GetTypeCode(value);
switch (typeCode)
{
case TypeCode.Boolean:
property.Add(PropertyType, PropertyTypeBoolean);
property.Add(PropertyValue, JToken.FromObject(value));
break;
case TypeCode.Char:
case TypeCode.String:
property.Add(PropertyType, PropertyTypeString);
property.Add(PropertyValue, JToken.FromObject(value));
break;
case TypeCode.SByte:
case TypeCode.Byte:
case TypeCode.Int16:
case TypeCode.UInt16:
case TypeCode.Int32:
case TypeCode.UInt32:
case TypeCode.Int64:
case TypeCode.UInt64:
case TypeCode.Single:
case TypeCode.Double:
case TypeCode.Decimal:
property.Add(PropertyType, PropertyTypeNumber);
property.Add(PropertyValue, JToken.FromObject(value));
break;
case TypeCode.DateTime:
property.Add(PropertyType, PropertyTypeDatetime);
property.Add(PropertyValue, JToken.FromObject(value));
break;
default:
throw new JsonException("Invalid value type");
}
}
return property;
}
private static IDictionary<string, object> ReadProperties(JArray value)
{
if (value == null)
{
return null;
}
var properties = new Dictionary<string, object>();
foreach (var property in value.Children())
{
var pair = ReadProperty((JObject)property);
properties.Add(pair.Key, pair.Value);
}
return properties;
}
private static KeyValuePair<string, object> ReadProperty(JObject property)
{
string type = property.Value<string>(PropertyType);
string name = property.Value<string>(PropertyName);
object value;
switch (type)
{
case PropertyTypeClear:
value = null;
break;
case PropertyTypeBoolean:
value = property.Value<bool>(PropertyValue);
break;
case PropertyTypeNumber:
switch (property.GetValue(PropertyValue).Type)
{
case JTokenType.Integer:
value = property.Value<int>(PropertyValue);
break;
case JTokenType.Float:
value = property.Value<float>(PropertyValue);
break;
default:
throw new JsonException("Invalid value type");
}
break;
case PropertyTypeDatetime:
value = property.Value<DateTime>(PropertyValue);
break;
case PropertyTypeString:
value = property.Value<string>(PropertyValue);
break;
default:
throw new JsonException("Invalid value type");
}
return new KeyValuePair<string, object>(name, value);
}
}
}

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.AppCenter.Ingestion.Models.Serialization;
using Newtonsoft.Json;
using System.Linq;
public abstract class CustomProperty
{
private const int MaxNameLength = 128;
private const string KeyPattern = "^[a-zA-Z][a-zA-Z0-9\\-_]*$";
/// <summary>
/// Initializes a new instance of the CustomProperty class.
/// </summary>
public CustomProperty() { }
/// <summary>
/// Initializes a new instance of the CustomProperty class.
/// </summary>
public CustomProperty(string name)
{
Name = name;
}
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
public abstract object GetValue();
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Name == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Name));
}
if (Name != null)
{
if (Name.Length > MaxNameLength)
{
throw new ValidationException(ValidationException.Rule.MaxLength, nameof(Name), MaxNameLength);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(Name, KeyPattern))
{
throw new ValidationException(ValidationException.Rule.Pattern, nameof(Name), KeyPattern);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,76 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.AppCenter.Ingestion.Models.Serialization;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// The custom properties log model.
/// </summary>
[JsonObject(JsonIdentifier)]
public class CustomPropertyLog : Log
{
internal const string JsonIdentifier = "customProperties";
/// <summary>
/// Initializes a new instance of the CustomPropertyLog class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Custom property changes.</param>
public CustomPropertyLog()
{
Properties = new List<CustomProperty>();
}
/// <summary>
/// Gets or sets custom property changes.
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IList<CustomProperty> Properties { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Properties != null)
{
if (Properties.Count > 60)
{
throw new ValidationException(ValidationException.Rule.MaxItems, nameof(Properties), 60);
}
if (Properties.Count < 1)
{
throw new ValidationException(ValidationException.Rule.MinItems, nameof(Properties), 1);
}
foreach (var element in Properties)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,56 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Date and time property.
/// </summary>
[JsonObject(JsonIdentifier)]
public partial class DateTimeProperty : CustomProperty
{
internal const string JsonIdentifier = "dateTime";
/// <summary>
/// Initializes a new instance of the DateTimeProperty class.
/// </summary>
public DateTimeProperty() { }
/// <summary>
/// Initializes a new instance of the DateTimeProperty class.
/// </summary>
/// <param name="value">Date time property value.</param>
public DateTimeProperty(string name, System.DateTime value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets date time property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public System.DateTime Value { get; set; }
public override object GetValue()
{
return Value;
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -1,8 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using Newtonsoft.Json;
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Device characteristics.
/// </summary>
@ -22,24 +28,17 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// <param name="sdkVersion">Version of the SDK in semver format, e.g.
/// "1.2.0" or "0.12.3-alpha.1".
/// </param>
/// <param name="model">Device model (example: iPad2,3).
/// </param>
/// <param name="oemName">Device manufacturer (example: HTC).
/// </param>
/// <param name="osName">OS name (example: iOS). The following OS names
/// are standardized (non-exclusive): Android, iOS, macOS, tvOS,
/// Windows.
/// </param>
/// <param name="osVersion">OS version (example: 9.3.0).
/// </param>
/// <param name="locale">Language code (example: en_US).
/// <param name="locale">Language code (example: en-US).
/// </param>
/// <param name="timeZoneOffset">The offset in minutes from UTC for the
/// device time zone, including daylight savings time.
/// </param>
/// <param name="screenSize">Screen size of the device in pixels
/// (example: 640x480).
/// </param>
/// <param name="appVersion">Application version name, e.g. 1.1.0
/// </param>
/// <param name="appBuild">The app's build number, e.g. 42.
@ -54,11 +53,18 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// the name of the SDK and the wrapper platform, e.g.
/// "mobilecenter.xamarin", "hockeysdk.cordova".
/// </param>
/// <param name="model">Device model (example: iPad2,3).
/// </param>
/// <param name="oemName">Device manufacturer (example: HTC).
/// </param>
/// <param name="osBuild">OS build code (example: LMY47X).
/// </param>
/// <param name="osApiLevel">API level when applicable like in Android
/// (example: 15).
/// </param>
/// <param name="screenSize">Screen size of the device in pixels
/// (example: 640x480).
/// </param>
/// <param name="carrierName">Carrier name (for mobile devices).
/// </param>
/// <param name="carrierCountry">Carrier country code (for mobile
@ -79,9 +85,14 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// <param name="liveUpdatePackageHash">Hash of all files (ReactNative
/// or Cordova) deployed to device via LiveUpdate beacon. Helps
/// identify the Release version on device or need to download updates
/// in future
/// in future.
/// </param>
public Device(string sdkName, string sdkVersion, string model, string oemName, string osName, string osVersion, string locale, int timeZoneOffset, string screenSize, string appVersion, string appBuild, string wrapperSdkVersion = default(string), string wrapperSdkName = default(string), string osBuild = default(string), int? osApiLevel = default(int?), string carrierName = default(string), string carrierCountry = default(string), string appNamespace = default(string), string liveUpdateReleaseLabel = default(string), string liveUpdateDeploymentKey = default(string), string liveUpdatePackageHash = default(string))
/// <param name="wrapperRuntimeVersion">Version of the wrapper
/// technology framework (Xamarin runtime version or ReactNative or
/// Cordova etc...). See wrappersdkname to see if this version refers
/// to Xamarin or ReactNative or other.
/// </param>
public Device(string sdkName, string sdkVersion, string osName, string osVersion, string locale, int timeZoneOffset, string appVersion, string appBuild, string wrapperSdkVersion = default(string), string wrapperSdkName = default(string), string model = default(string), string oemName = default(string), string osBuild = default(string), int? osApiLevel = default(int?), string screenSize = default(string), string carrierName = default(string), string carrierCountry = default(string), string appNamespace = default(string), string liveUpdateReleaseLabel = default(string), string liveUpdateDeploymentKey = default(string), string liveUpdatePackageHash = default(string), string wrapperRuntimeVersion = default(string))
{
SdkName = sdkName;
SdkVersion = sdkVersion;
@ -104,6 +115,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
LiveUpdateReleaseLabel = liveUpdateReleaseLabel;
LiveUpdateDeploymentKey = liveUpdateDeploymentKey;
LiveUpdatePackageHash = liveUpdatePackageHash;
WrapperRuntimeVersion = wrapperRuntimeVersion;
}
/// <summary>
@ -111,7 +123,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// the platform, e.g. "mobilecenter.ios", "hockeysdk.android".
///
/// </summary>
[JsonProperty(PropertyName = "sdk_name")]
[JsonProperty(PropertyName = "sdkName")]
public string SdkName { get; set; }
/// <summary>
@ -119,7 +131,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// "0.12.3-alpha.1".
///
/// </summary>
[JsonProperty(PropertyName = "sdk_version")]
[JsonProperty(PropertyName = "sdkVersion")]
public string SdkVersion { get; set; }
/// <summary>
@ -129,7 +141,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// field while sdkVersion refers to the original Android SDK.
///
/// </summary>
[JsonProperty(PropertyName = "wrapper_sdk_version")]
[JsonProperty(PropertyName = "wrapperSdkVersion")]
public string WrapperSdkVersion { get; set; }
/// <summary>
@ -138,7 +150,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// "hockeysdk.cordova".
///
/// </summary>
[JsonProperty(PropertyName = "wrapper_sdk_name")]
[JsonProperty(PropertyName = "wrapperSdkName")]
public string WrapperSdkName { get; set; }
/// <summary>
@ -152,7 +164,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// Gets or sets device manufacturer (example: HTC).
///
/// </summary>
[JsonProperty(PropertyName = "oem_name")]
[JsonProperty(PropertyName = "oemName")]
public string OemName { get; set; }
/// <summary>
@ -160,21 +172,21 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// standardized (non-exclusive): Android, iOS, macOS, tvOS, Windows.
///
/// </summary>
[JsonProperty(PropertyName = "os_name")]
[JsonProperty(PropertyName = "osName")]
public string OsName { get; set; }
/// <summary>
/// Gets or sets OS version (example: 9.3.0).
///
/// </summary>
[JsonProperty(PropertyName = "os_version")]
[JsonProperty(PropertyName = "osVersion")]
public string OsVersion { get; set; }
/// <summary>
/// Gets or sets OS build code (example: LMY47X).
///
/// </summary>
[JsonProperty(PropertyName = "os_build")]
[JsonProperty(PropertyName = "osBuild")]
public string OsBuild { get; set; }
/// <summary>
@ -182,11 +194,11 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// 15).
///
/// </summary>
[JsonProperty(PropertyName = "os_api_level")]
[JsonProperty(PropertyName = "osApiLevel")]
public int? OsApiLevel { get; set; }
/// <summary>
/// Gets or sets language code (example: en_US).
/// Gets or sets language code (example: en-US).
///
/// </summary>
[JsonProperty(PropertyName = "locale")]
@ -197,7 +209,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// zone, including daylight savings time.
///
/// </summary>
[JsonProperty(PropertyName = "time_zone_offset")]
[JsonProperty(PropertyName = "timeZoneOffset")]
public int TimeZoneOffset { get; set; }
/// <summary>
@ -205,35 +217,35 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// 640x480).
///
/// </summary>
[JsonProperty(PropertyName = "screen_size")]
[JsonProperty(PropertyName = "screenSize")]
public string ScreenSize { get; set; }
/// <summary>
/// Gets or sets application version name, e.g. 1.1.0
///
/// </summary>
[JsonProperty(PropertyName = "app_version")]
[JsonProperty(PropertyName = "appVersion")]
public string AppVersion { get; set; }
/// <summary>
/// Gets or sets carrier name (for mobile devices).
///
/// </summary>
[JsonProperty(PropertyName = "carrier_name")]
[JsonProperty(PropertyName = "carrierName")]
public string CarrierName { get; set; }
/// <summary>
/// Gets or sets carrier country code (for mobile devices).
///
/// </summary>
[JsonProperty(PropertyName = "carrier_country")]
[JsonProperty(PropertyName = "carrierCountry")]
public string CarrierCountry { get; set; }
/// <summary>
/// Gets or sets the app's build number, e.g. 42.
///
/// </summary>
[JsonProperty(PropertyName = "app_build")]
[JsonProperty(PropertyName = "appBuild")]
public string AppBuild { get; set; }
/// <summary>
@ -242,7 +254,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// com.microsoft.example.
///
/// </summary>
[JsonProperty(PropertyName = "app_namespace")]
[JsonProperty(PropertyName = "appNamespace")]
public string AppNamespace { get; set; }
/// <summary>
@ -250,7 +262,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// 'version' released via Live Update beacon running on device
///
/// </summary>
[JsonProperty(PropertyName = "live_update_release_label")]
[JsonProperty(PropertyName = "liveUpdateReleaseLabel")]
public string LiveUpdateReleaseLabel { get; set; }
/// <summary>
@ -259,18 +271,28 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// Production, Staging.
///
/// </summary>
[JsonProperty(PropertyName = "live_update_deployment_key")]
[JsonProperty(PropertyName = "liveUpdateDeploymentKey")]
public string LiveUpdateDeploymentKey { get; set; }
/// <summary>
/// Gets or sets hash of all files (ReactNative or Cordova) deployed to
/// device via LiveUpdate beacon. Helps identify the Release version on
/// device or need to download updates in future
/// device or need to download updates in future.
///
/// </summary>
[JsonProperty(PropertyName = "live_update_package_hash")]
[JsonProperty(PropertyName = "liveUpdatePackageHash")]
public string LiveUpdatePackageHash { get; set; }
/// <summary>
/// Gets or sets version of the wrapper technology framework (Xamarin
/// runtime version or ReactNative or Cordova etc...). See
/// wrappersdkname to see if this version refers to Xamarin or
/// ReactNative or other.
///
/// </summary>
[JsonProperty(PropertyName = "wrapperRuntimeVersion")]
public string WrapperRuntimeVersion { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
@ -287,14 +309,6 @@ namespace Microsoft.AppCenter.Ingestion.Models
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(SdkVersion));
}
if (Model == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Model));
}
if (OemName == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(OemName));
}
if (OsName == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(OsName));
@ -307,10 +321,6 @@ namespace Microsoft.AppCenter.Ingestion.Models
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Locale));
}
if (ScreenSize == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(ScreenSize));
}
if (AppVersion == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(AppVersion));
@ -319,6 +329,14 @@ namespace Microsoft.AppCenter.Ingestion.Models
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(AppBuild));
}
if (TimeZoneOffset > 840)
{
throw new ValidationException(ValidationException.Rule.InclusiveMaximum, nameof(TimeZoneOffset), 840);
}
if (TimeZoneOffset < -840)
{
throw new ValidationException(ValidationException.Rule.InclusiveMinimum, nameof(TimeZoneOffset), -840);
}
}
}
}

Просмотреть файл

@ -1,10 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using Newtonsoft.Json;
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public abstract class Log
{
/// <summary>
@ -15,8 +19,9 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// <summary>
/// Initializes a new instance of the Log class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -25,7 +30,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
protected Log(DateTime? timestamp, Device device, Guid? sid = default(Guid?))
public Log(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?))
{
Timestamp = timestamp;
Sid = sid;
@ -33,10 +38,11 @@ namespace Microsoft.AppCenter.Ingestion.Models
}
/// <summary>
/// Log timestamp.
/// Gets or sets log timestamp, example: '2017-03-13T18:05:42Z'.
///
/// </summary>
[JsonProperty(PropertyName = "timestamp")]
public DateTime? Timestamp { get; set; }
public System.DateTime? Timestamp { get; set; }
/// <summary>
/// Gets or sets when tracking an analytics session, logs can be part
@ -49,7 +55,7 @@ namespace Microsoft.AppCenter.Ingestion.Models
///
/// </summary>
[JsonProperty(PropertyName = "sid")]
public Guid? Sid { get; set; }
public System.Guid? Sid { get; set; }
/// <summary>
/// </summary>
@ -68,8 +74,10 @@ namespace Microsoft.AppCenter.Ingestion.Models
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Device));
}
Device.Validate();
if (Device != null)
{
Device.Validate();
}
}
}
}

Просмотреть файл

@ -1,10 +1,14 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using Newtonsoft.Json;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public class LogContainer
{
/// <summary>
@ -39,13 +43,19 @@ namespace Microsoft.AppCenter.Ingestion.Models
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Logs));
}
if (Logs.Count == 0)
if (Logs != null)
{
throw new ValidationException(ValidationException.Rule.CannotBeEmpty, nameof(Logs));
}
foreach (var element in Logs)
{
element?.Validate();
if (Logs.Count < 1)
{
throw new ValidationException(ValidationException.Rule.MinItems, nameof(Logs), 1);
}
foreach (var element in Logs)
{
if (element != null)
{
element.Validate();
}
}
}
}
}

Просмотреть файл

@ -1,23 +1,27 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using Newtonsoft.Json;
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public abstract class LogWithProperties : Log
{
/// <summary>
/// Initializes a new instance of the LogWithProperties class.
/// </summary>
protected LogWithProperties() { }
public LogWithProperties() { }
/// <summary>
/// Initializes a new instance of the LogWithProperties class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -26,9 +30,10 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Additional key/value pair parameters.</param>
protected LogWithProperties(DateTime? timestamp, Device device, Guid? sid = default(Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(timestamp, device, sid)
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public LogWithProperties(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid)
{
Properties = properties;
}
@ -39,6 +44,16 @@ namespace Microsoft.AppCenter.Ingestion.Models
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IDictionary<string, string> Properties { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,100 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Number property.
/// </summary>
[JsonObject(JsonIdentifier)]
public partial class NumberProperty : CustomProperty
{
internal const string JsonIdentifier = "number";
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
public NumberProperty() { }
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, int value)
: base(name)
{
Value = value;
}
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, long value)
: base(name)
{
Value = value;
}
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, float value)
: base(name)
{
Value = value;
}
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, double value)
: base(name)
{
Value = value;
}
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, decimal value)
: base(name)
{
Value = value;
}
// Use object because number can be either decimal or double (or other numeric types).
// Decimal has narrower range than double but double has lower precision. Thus, they
// can't be casted between.
/// <summary>
/// Gets or sets number property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public object Value { get; set; }
public override object GetValue()
{
return Value;
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,69 @@
using System;
using System.Collections.Generic;
using System.Reflection;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Microsoft.AppCenter.Ingestion.Models.Serialization
{
public class CustomPropertyJsonConverter : JsonConverter
{
private readonly Dictionary<string, Type> _customPropertyTypes = new Dictionary<string, Type>
{
{ BooleanProperty.JsonIdentifier, typeof(BooleanProperty) },
{ ClearProperty.JsonIdentifier, typeof(ClearProperty) },
{ DateTimeProperty.JsonIdentifier, typeof(DateTimeProperty) },
{ NumberProperty.JsonIdentifier, typeof(NumberProperty) },
{ StringProperty.JsonIdentifier, typeof(StringProperty) }
};
private readonly object _jsonConverterLock = new object();
private static readonly JsonSerializerSettings SerializationSettings;
internal const string TypeIdKey = "type";
public CustomPropertyJsonConverter()
{
_customPropertyTypes[BooleanProperty.JsonIdentifier] = typeof(BooleanProperty);
_customPropertyTypes[ClearProperty.JsonIdentifier] = typeof(ClearProperty);
_customPropertyTypes[ClearProperty.JsonIdentifier] = typeof(ClearProperty);
_customPropertyTypes[ClearProperty.JsonIdentifier] = typeof(ClearProperty);
}
public override bool CanConvert(Type objectType)
{
return typeof(CustomProperty).IsAssignableFrom(objectType);
}
public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer)
{
Type logType;
var jsonObject = JObject.Load(reader);
var typeName = jsonObject.GetValue(TypeIdKey)?.ToString();
lock (_jsonConverterLock)
{
if (typeName == null || !_customPropertyTypes.ContainsKey(typeName))
{
throw new JsonReaderException("Could not identify type of log");
}
logType = _customPropertyTypes[typeName];
}
jsonObject.Remove(TypeIdKey);
return jsonObject.ToObject(logType);
}
public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer)
{
var info = value.GetType().GetTypeInfo();
var attribute = info.GetCustomAttribute(typeof(JsonObjectAttribute)) as JsonObjectAttribute;
if (attribute == null)
{
throw new JsonWriterException("Cannot serialize property; Log type is missing JsonObjectAttribute");
}
var jsonText = JsonConvert.SerializeObject(value, SerializationSettings);
var jsonObject = JObject.Parse(jsonText);
jsonObject.Add(TypeIdKey, JToken.FromObject(attribute.Id));
writer.WriteRawValue(jsonObject.ToString());
}
}
}

Просмотреть файл

@ -11,6 +11,7 @@ namespace Microsoft.AppCenter.Ingestion.Models.Serialization
private readonly Dictionary<string, Type> _logTypes = new Dictionary<string, Type>();
private readonly object _jsonConverterLock = new object();
private static readonly JsonSerializerSettings SerializationSettings;
internal const string TypeIdKey = "type";
static LogJsonConverter()
@ -21,7 +22,8 @@ namespace Microsoft.AppCenter.Ingestion.Models.Serialization
DateFormatHandling = DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = DateTimeZoneHandling.Utc,
NullValueHandling = NullValueHandling.Ignore,
ReferenceLoopHandling = ReferenceLoopHandling.Serialize
ReferenceLoopHandling = ReferenceLoopHandling.Serialize,
Converters = { new CustomPropertyJsonConverter() }
};
}
@ -50,8 +52,12 @@ namespace Microsoft.AppCenter.Ingestion.Models.Serialization
throw new JsonReaderException("Could not identify type of log");
}
logType = _logTypes[typeName];
jsonObject.Remove(TypeIdKey);
if (logType == typeof(CustomPropertyLog))
{
return ReadCustomPropertyLog(jsonObject);
}
}
jsonObject.Remove(TypeIdKey);
return jsonObject.ToObject(logType);
}
@ -63,11 +69,25 @@ namespace Microsoft.AppCenter.Ingestion.Models.Serialization
{
throw new JsonWriterException("Cannot serialize log; Log type is missing JsonObjectAttribute");
}
var jsonText = JsonConvert.SerializeObject(value, SerializationSettings);
var jsonObject = JObject.Parse(jsonText);
jsonObject.Add(TypeIdKey, JToken.FromObject(attribute.Id));
writer.WriteRawValue(jsonObject.ToString());
}
public Log ReadCustomPropertyLog(JObject logObject)
{
var propertiesIdentifier = "properties";
var propertiesJson = logObject.GetValue(propertiesIdentifier);
logObject.Remove(propertiesIdentifier);
var customPropertiesLog = logObject.ToObject(typeof(CustomPropertyLog)) as CustomPropertyLog;
foreach (var child in propertiesJson.Children())
{
var propertyJson = child.ToString();
var property = JsonConvert.DeserializeObject<CustomProperty>(propertyJson, SerializationSettings);
customPropertiesLog.Properties.Add(property);
}
return customPropertiesLog;
}
}
}

Просмотреть файл

@ -10,10 +10,10 @@ namespace Microsoft.AppCenter.Ingestion.Models
[JsonObject(JsonIdentifier)]
public class StartServiceLog : Log
{
internal const string JsonIdentifier = "start_service";
internal const string JsonIdentifier = "startService";
/// <summary>
/// Initializes a new instance of the Log class.
/// Initializes a new instance of the StartServiceLog class.
/// </summary>
public StartServiceLog()
{
@ -21,29 +21,33 @@ namespace Microsoft.AppCenter.Ingestion.Models
}
/// <summary>
/// Initializes a new instance of the Log class
/// Initializes a new instance of the StartServiceLog class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="services">Names of services which started with SDK</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.</param>
public StartServiceLog(DateTime? timestamp, Device device, IEnumerable<string> services, Guid? sid = default(Guid?))
: base(timestamp, device, sid)
/// session and always include this identifier.
/// </param>
/// <param name="services">The list of services of the MobileCenter
/// Start API call.</param>
public StartServiceLog(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IList<string> services = default(IList<string>))
: base(device, timestamp, sid)
{
Services = new List<string>(services);
Services = services;
}
/// <summary>
/// Services names which have been started
/// Gets or sets the list of services of the MobileCenter Start API
/// call.
/// </summary>
[JsonProperty(PropertyName = "services")]
public List<string> Services { get; set; }
public IList<string> Services { get; set; }
/// <summary>
/// Validate the object.
@ -54,10 +58,12 @@ namespace Microsoft.AppCenter.Ingestion.Models
public override void Validate()
{
base.Validate();
if (Services == null)
if (Services != null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Services));
if (Services.Count < 1)
{
throw new ValidationException(ValidationException.Rule.MinItems, nameof(Services), 1);
}
}
}
}

Просмотреть файл

@ -0,0 +1,66 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// String property.
/// </summary>
[JsonObject(JsonIdentifier)]
public partial class StringProperty : CustomProperty
{
internal const string JsonIdentifier = "string";
/// <summary>
/// Initializes a new instance of the StringProperty class.
/// </summary>
public StringProperty() { }
/// <summary>
/// Initializes a new instance of the StringProperty class.
/// </summary>
/// <param name="value">String property value.</param>
public StringProperty(string name, string value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets string property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public string Value { get; set; }
public override object GetValue()
{
return Value;
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Value == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Value));
}
if (Value != null)
{
if (Value.Length > 128)
{
throw new ValidationException(ValidationException.Rule.MaxLength, nameof(Value), 128);
}
}
}
}
}

Просмотреть файл

@ -13,15 +13,22 @@
public enum Rule
{
CannotBeNull,
CannotBeEmpty
CannotBeEmpty,
MaxItems,
MinItems,
MaxLength,
Pattern,
InclusiveMinimum,
InclusiveMaximum
}
/// <summary>
/// Gets a string message that describes a given validation rule
/// </summary>
/// <param name="rule">The rule to create a string for</param>
/// <param name="extraValue">An extra detail to include with the rule.</param>
/// <returns>A string describing the rule</returns>
private static string GetRuleString(Rule rule)
private static string GetRuleString(Rule rule, string extraValue)
{
switch (rule)
{
@ -29,6 +36,18 @@
return "Cannot be null";
case Rule.CannotBeEmpty:
return "Cannot be empty";
case Rule.MaxItems:
return $"Number of items exceeded maximum of {extraValue}";
case Rule.MinItems:
return $"Number of items less than minimum of {extraValue}";
case Rule.MaxLength:
return $"Maximum length of {extraValue} exceeded";
case Rule.Pattern:
return $"Does not match expected pattern: {extraValue}";
case Rule.InclusiveMaximum:
return $"Item exceeds maximum value of {extraValue}";
case Rule.InclusiveMinimum:
return $"Item is less than minimum value of {extraValue}";
default:
return "Unknown rule";
}
@ -40,9 +59,9 @@
/// <param name="validationRule">The rule that was broken</param>
/// <param name="propertyName">The name of the property that broke the rule</param>
/// <returns></returns>
private static string GetErrorString(Rule validationRule, string propertyName)
private static string GetErrorString(Rule validationRule, string propertyName, object detail)
{
return $"Validation failed due to property '{propertyName}': {GetRuleString(validationRule)}";
return $"Validation failed due to property '{propertyName}': {GetRuleString(validationRule, detail?.ToString())}";
}
public ValidationException() : base(DefaultMessage)
@ -58,7 +77,7 @@
/// </summary>
/// <param name="validationRule">The rule that was broken</param>
/// <param name="propertyName">The name of the property that broke the rule</param>
public ValidationException(Rule validationRule, string propertyName) : base(GetErrorString(validationRule, propertyName))
public ValidationException(Rule validationRule, string propertyName, object detail = null) : base(GetErrorString(validationRule, propertyName, detail))
{
}
}

Просмотреть файл

@ -22,7 +22,14 @@
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Http\HttpIngestionException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Http\IHttpNetworkAdapter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Http\NetworkIngestionException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\CustomPropertiesLog.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\BooleanProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\ClearProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\CustomProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\CustomPropertyLog.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\DateTimeProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\NumberProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\Serialization\CustomPropertyJsonConverter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\StringProperty.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Ingestion\Models\ValidationException.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Storage\IStorageAdapter.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Storage\StorageAdapter.cs" />
@ -66,7 +73,4 @@
<Compile Include="$(MSBuildThisFileDirectory)Utils\TimeHelper.cs" />
<Compile Include="$(MSBuildThisFileDirectory)Utils\UnhandledExceptionOccurredEventArgs.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="$(MSBuildThisFileDirectory)Ingestion\Models\Serialization\" />
</ItemGroup>
</Project>

Просмотреть файл

@ -1,12 +1,15 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
using System;
using System.Collections.Generic;
using Microsoft.AppCenter.Ingestion.Models;
using Newtonsoft.Json;
namespace Microsoft.AppCenter.Analytics.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.AppCenter.Ingestion.Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Device = Microsoft.AppCenter.Ingestion.Models.Device;
/// <summary>
@ -15,20 +18,23 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
[JsonObject(JsonIdentifier)]
public partial class EventLog : LogWithProperties
{
/// <summary>
/// Initializes a new instance of the EventLog class.
/// </summary>
public EventLog() { }
internal const string JsonIdentifier = "event";
/// <summary>
/// Initializes a new instance of the EventLog class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="id">Unique identifier for this event.</param>
/// <param name="name">Name of the event.</param>
public EventLog() { }
/// <summary>
/// Initializes a new instance of the EventLog class.
/// </summary>
/// <param name="id">Unique identifier for this event.
/// </param>
/// <param name="name">Name of the event.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -39,8 +45,8 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
/// </param>
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public EventLog(DateTime? timestamp, Device device, Guid id, string name, Guid? sid = default(Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(timestamp, device, sid, properties)
public EventLog(System.DateTime? timestamp, Device device, System.Guid id, string name, System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid, properties)
{
Id = id;
Name = name;
@ -51,7 +57,7 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
///
/// </summary>
[JsonProperty(PropertyName = "id")]
public Guid Id { get; set; }
public System.Guid Id { get; set; }
/// <summary>
/// Gets or sets name of the event.
@ -71,7 +77,14 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
base.Validate();
if (Name == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, "Name");
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Name));
}
if (Name != null)
{
if (Name.Length > 256)
{
throw new ValidationException(ValidationException.Rule.MaxLength, nameof(Name), 256);
}
}
}
}

Просмотреть файл

@ -15,19 +15,21 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
[JsonObject(JsonIdentifier)]
public partial class PageLog : LogWithProperties
{
/// <summary>
/// Initializes a new instance of the PageLog class.
/// </summary>
public PageLog() { }
internal const string JsonIdentifier = "page";
/// <summary>
/// Initializes a new instance of the PageLog class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="name">Name of the page.</param>
public PageLog() { }
/// <summary>
/// Initializes a new instance of the PageLog class.
/// </summary>
/// <param name="name">Name of the page.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -36,9 +38,10 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Additional key/value pair parameters.</param>
public PageLog(DateTime? timestamp, Device device, string name, Guid? sid = default(Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(timestamp, device, sid, properties)
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public PageLog(Device device, string name, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid, properties)
{
Name = name;
}
@ -61,7 +64,7 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
base.Validate();
if (Name == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, "Name");
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(Name));
}
}
}

Просмотреть файл

@ -15,20 +15,20 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
[JsonObject(JsonIdentifier)]
public partial class StartSessionLog : Log
{
internal static StartSessionLog Empty = new StartSessionLog();
internal const string JsonIdentifier = "startSession";
/// <summary>
/// Initializes a new instance of the StartSessionLog class.
/// </summary>
public StartSessionLog() { }
internal static StartSessionLog Empty = new StartSessionLog();
internal const string JsonIdentifier = "start_session";
/// <summary>
/// Initializes a new instance of the StartSessionLog class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -37,10 +37,21 @@ namespace Microsoft.AppCenter.Analytics.Ingestion.Models
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
public StartSessionLog(DateTime? timestamp, Device device, Guid? sid = default(Guid?))
: base(timestamp, device, sid)
public StartSessionLog(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?))
: base(device, timestamp, sid)
{
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -16,4 +16,5 @@
<PackageReference Include="MSBuild.Sdk.Extras" Version="1.1.0" PrivateAssets="All" />
</ItemGroup>
<Import Project="$(MSBuildSDKExtrasTargets)" Condition="Exists('$(MSBuildSDKExtrasTargets)')" />
<Target Name="GetPackagingOutputs" />
</Project>

Просмотреть файл

@ -17,11 +17,11 @@ namespace Microsoft.AppCenter.Push
return PlatformIsEnabledAsync();
}
/// <summary>
/// Enable or disable the Push service.
/// </summary>
/// <returns>A task to monitor the operation.</returns>
public static Task SetEnabledAsync(bool enabled)
/// <summary>
/// Enable or disable the Push service.
/// </summary>
/// <returns>A task to monitor the operation.</returns>
public static Task SetEnabledAsync(bool enabled)
{
return PlatformSetEnabledAsync(enabled);
}

Просмотреть файл

@ -1,22 +1,33 @@
using System;
using Microsoft.AppCenter.Ingestion.Models;
using Newtonsoft.Json;
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Push.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.AppCenter.Ingestion.Models;
using Newtonsoft.Json;
using System.Linq;
using Device = Microsoft.AppCenter.Ingestion.Models.Device;
[JsonObject(JsonIdentifier)]
public class PushInstallationLog : Log
{
internal const string JsonIdentifier = "push_installation";
internal const string JsonIdentifier = "pushInstallation";
/// <summary>
/// Initializes a new instance of the PushInstallationLog class.
/// </summary>
/// <param name="timestamp">Log timestamp.</param>
/// <param name="device">Description of the device emitting the log.</param>
/// <param name="pushToken">The Windows Push Notification handle for this installation.</param>
public PushInstallationLog() { }
/// <summary>
/// Initializes a new instance of the PushInstallationLog class.
/// </summary>
/// <param name="pushToken">The PNS handle for this installation.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
@ -25,31 +36,31 @@ namespace Microsoft.AppCenter.Push.Ingestion.Models
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
public PushInstallationLog(DateTime? timestamp, Device device, string pushToken, Guid? sid = default(Guid?))
: base(timestamp, device, sid)
public PushInstallationLog(System.DateTime? timestamp, Device device, string pushToken, System.Guid? sid = default(System.Guid?))
: base(device, timestamp, sid)
{
PushToken = pushToken;
}
/// <summary>
/// The Windows Push Notification handle for this installation.
/// Gets or sets the PNS handle for this installation.
///
/// </summary>
[JsonProperty(PropertyName = "push_token")]
[JsonProperty(PropertyName = "pushToken")]
public string PushToken { get; set; }
/// <summary>
/// Validate the PushInstallationLog
/// Validate the object.
/// </summary>
/// <exception cref="ValidationException">
/// Thrown if PushToken is null or empty
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (string.IsNullOrEmpty(this.PushToken))
if (PushToken == null)
{
throw new ValidationException(ValidationException.Rule.CannotBeNull, "PushToken");
throw new ValidationException(ValidationException.Rule.CannotBeNull, nameof(PushToken));
}
}
}

Просмотреть файл

@ -23,7 +23,7 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
var mockDevice = new Mock<Device>();
PageLog emptyLog = new PageLog();
PageLog log = new PageLog(Timestamp, mockDevice.Object, Name);
PageLog log = new PageLog(mockDevice.Object, Name, Timestamp);
Assert.IsNotNull(emptyLog);
Assert.IsNotNull(log);
@ -40,7 +40,7 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
const string NullName = null;
var mockDevice = new Mock<Device>();
PageLog log = new PageLog(Timestamp, mockDevice.Object, NullName);
PageLog log = new PageLog(mockDevice.Object, NullName, Timestamp);
Assert.ThrowsException<ValidationException>(() => log.Validate());
}
}

Просмотреть файл

@ -21,7 +21,7 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
var mockDevice = new Mock<Device>();
StartSessionLog emptyLog = new StartSessionLog();
StartSessionLog log = new StartSessionLog(Timestamp, mockDevice.Object);
StartSessionLog log = new StartSessionLog(mockDevice.Object, Timestamp);
Assert.IsNotNull(emptyLog);
Assert.IsNotNull(log);

Просмотреть файл

@ -515,7 +515,7 @@ namespace Microsoft.AppCenter.Test
var properties = new CustomProperties();
properties.Set("test", "test");
AppCenter.SetCustomProperties(properties);
channelUnitMock.Verify(channel => channel.EnqueueAsync(It.Is<CustomPropertiesLog>(log =>
channelUnitMock.Verify(channel => channel.EnqueueAsync(It.Is<CustomPropertyLog>(log =>
log.Properties == properties.Properties)), Times.Once());
}
}

Просмотреть файл

@ -1,5 +1,8 @@
using System;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Linq;
using Microsoft.AppCenter.Ingestion.Models;
using System.Collections.Generic;
namespace Microsoft.AppCenter.Test.Windows
{
@ -144,7 +147,7 @@ namespace Microsoft.AppCenter.Test.Windows
var normalValue = "test";
properties.Set(key, normalValue);
Assert.AreEqual(1, properties.Properties.Count);
Assert.AreEqual(normalValue, properties.Properties[key]);
FindProperty(properties.Properties, key, normalValue);
}
/// <summary>
@ -161,7 +164,7 @@ namespace Microsoft.AppCenter.Test.Windows
var normalValue = new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc);
properties.Set(key, normalValue);
Assert.AreEqual(1, properties.Properties.Count);
Assert.AreEqual(normalValue, properties.Properties[key]);
FindProperty(properties.Properties, key, normalValue);
}
/// <summary>
@ -185,15 +188,15 @@ namespace Microsoft.AppCenter.Test.Windows
properties.Set("t4", value4);
properties.Set("t5", value5);
Assert.AreEqual(5, properties.Properties.Count);
Assert.AreEqual(value1, properties.Properties["t1"]);
Assert.AreEqual(value2, properties.Properties["t2"]);
Assert.AreEqual(value3, properties.Properties["t3"]);
Assert.AreEqual(value4, properties.Properties["t4"]);
Assert.AreEqual(value5, properties.Properties["t5"]);
FindProperty(properties.Properties, "t1", value1);
FindProperty(properties.Properties, "t2", value2);
FindProperty(properties.Properties, "t3", value3);
FindProperty(properties.Properties, "t4", value4);
FindProperty(properties.Properties, "t5", value5);
}
/// <summary>
/// Verify that bool setting correct.
/// Verify that bool setting correc
/// </summary>
[TestMethod]
public void TestSetBool()
@ -206,7 +209,7 @@ namespace Microsoft.AppCenter.Test.Windows
var normalValue = false;
properties.Set(key, normalValue);
Assert.AreEqual(1, properties.Properties.Count);
Assert.AreEqual(normalValue, properties.Properties[key]);
FindProperty(properties.Properties, key, normalValue);
}
/// <summary>
@ -220,7 +223,22 @@ namespace Microsoft.AppCenter.Test.Windows
Assert.AreEqual(0, properties.Properties.Count);
properties.Clear(key);
Assert.AreEqual(1, properties.Properties.Count);
Assert.IsNull(properties.Properties[key]);
FindProperty(properties.Properties, key, null);
}
private static void FindProperty(IList<CustomProperty> properties, string key, object value)
{
CustomProperty compareProperty = null;
foreach (var elt in properties)
{
if (elt.Name == key)
{
compareProperty = elt;
break;
}
}
Assert.IsNotNull(compareProperty);
Assert.AreEqual(value, compareProperty.GetValue());
}
}
}

Просмотреть файл

@ -10,12 +10,12 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
[TestClass]
public class CustomPropertiesLogTest
{
private const string StorageTestChannelName = "customPropertiesStorageTestChannelName";
private const string StorageTestChannelName = "customPropertyStorageTestChannelName";
[TestInitialize]
public void InitializeStartServiceTest()
{
LogSerializer.AddLogType(CustomPropertiesLog.JsonIdentifier, typeof(CustomPropertiesLog));
LogSerializer.AddLogType(CustomPropertyLog.JsonIdentifier, typeof(CustomPropertyLog));
}
/// <summary>
@ -24,7 +24,7 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
[TestMethod]
public void CheckInitialValues()
{
var log = new CustomPropertiesLog();
var log = new CustomPropertyLog();
Assert.IsNull(log.Device);
Assert.AreEqual(0, log.Properties.Count);
Assert.IsNull(log.Sid);
@ -37,18 +37,18 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
[TestMethod]
public void SaveCustomPropertiesLog()
{
var addedLog = new CustomPropertiesLog
var addedLog = new CustomPropertyLog
{
Device = new DeviceInformationHelper().GetDeviceInformationAsync().RunNotAsync(),
Timestamp = DateTime.Now,
Properties = new Dictionary<string, object>
Properties = new List<CustomProperty>
{
{ "t1", "test" },
{ "t2", new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc) },
{ "t3", 1 },
{ "t4", 0.1f },
{ "t5", false },
{ "t6", null }
new StringProperty("t1", "test"),
new DateTimeProperty("t2", new DateTime(1970, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc)),
new NumberProperty("t3", (long)1),
new NumberProperty("t4", 0.1),
new BooleanProperty("t5", false),
new ClearProperty("t6")
},
Sid = Guid.NewGuid()
};
@ -58,30 +58,26 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
storage.PutLog(StorageTestChannelName, addedLog);
var retrievedLogs = new List<Log>();
storage.GetLogsAsync(StorageTestChannelName, 1, retrievedLogs).RunNotAsync();
var retrievedLog = retrievedLogs[0] as CustomPropertiesLog;
var retrievedLog = retrievedLogs[0] as CustomPropertyLog;
foreach (var addedProperty in addedLog.Properties)
{
object retrievedProperty;
Assert.IsTrue(retrievedLog.Properties.TryGetValue(addedProperty.Key, out retrievedProperty));
Assert.IsTrue(EqualityComparer<object>.Default.Equals(addedProperty.Value, retrievedProperty));
var retrievedProperty = GetPropertyWithName(retrievedLog.Properties, addedProperty.Name);
Assert.IsNotNull(retrievedProperty);
Assert.AreEqual(addedProperty.GetValue(), retrievedProperty.GetValue());
}
}
/// <summary>
/// Validate that log is not valid with nullable 'Properties'
/// </summary>
[TestMethod]
public void ValidateStartServiceLog()
private static CustomProperty GetPropertyWithName(IList<CustomProperty> properties, string name)
{
var log = new CustomPropertiesLog
foreach (var property in properties)
{
Properties = null,
Device = new DeviceInformationHelper().GetDeviceInformationAsync().RunNotAsync(),
Timestamp = DateTime.Now
};
Assert.ThrowsException<ValidationException>((Action)log.Validate);
if (property.Name == name)
{
return property;
}
}
return null;
}
}
}

Просмотреть файл

@ -28,8 +28,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
{
const string deafultString = default(string);
var emptyDevice = new Device();
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = OsVersion,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.IsNotNull(emptyDevice);
Assert.IsNotNull(device);
@ -63,8 +75,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateSuccessfullWhenAllFieldsArePresent()
{
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = OsVersion,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
device.Validate();
}
@ -74,8 +98,7 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenSdkNameIsNull()
{
const string nullSdkName = null;
var device = new Device(nullSdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device(null, SdkVersion, OsName, OsVersion, Locale, TimeZoneOffset, AppVersion, AppBuild, null, null, Model);
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -85,30 +108,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenSdkVersionIsNull()
{
const string nullSdkVersion = null;
var device = new Device(SdkName, nullSdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
/// <summary>
/// Verify that Validate method throws ValidationException when model == null.
/// </summary>
[TestMethod]
public void TestValidateThrowsExceptionWhenModelIsNull()
{
const string nullModel = null;
var device = new Device(SdkName, SdkVersion, nullModel, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
/// <summary>
/// Verify that Validate method throws ValidationException when oemName == null.
/// </summary>
[TestMethod]
public void TestValidateThrowsExceptionWhenOemNameIsNull()
{
const string nullOemName = null;
var device = new Device(SdkName, SdkVersion, Model, nullOemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = null,
OsName = OsName,
OsVersion = OsVersion,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -118,8 +131,7 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenOsNameIsNull()
{
const string nullOsName = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, nullOsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device(SdkName, SdkVersion, null, OsVersion, Locale, TimeZoneOffset, AppVersion, AppBuild, null, null, Model, OemName);
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -129,8 +141,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenOsVersionIsNull()
{
const string nullOsVersion = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, nullOsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = null,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -140,19 +164,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenLocaleIsNull()
{
const string nullLocale = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, nullLocale, TimeZoneOffset, ScreenSize, AppVersion, AppBuild);
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
/// <summary>
/// Verify that Validate method throws ValidationException when screenSize == null.
/// </summary>
[TestMethod]
public void TestValidateThrowsExceptionWhenScreenSizeIsNull()
{
const string nullScreenSize = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, nullScreenSize, AppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = OsVersion,
Locale = null,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -162,8 +187,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenAppVersionIsNull()
{
const string nullAppVersion = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, nullAppVersion, AppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = OsVersion,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = null,
AppBuild = AppBuild,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
@ -173,8 +210,20 @@ namespace Microsoft.AppCenter.Test.Ingestion.Models
[TestMethod]
public void TestValidateThrowsExceptionWhenAppBuildnIsNull()
{
const string nullAppBuild = null;
var device = new Device(SdkName, SdkVersion, Model, OemName, OsName, OsVersion, Locale, TimeZoneOffset, ScreenSize, AppVersion, nullAppBuild);
var device = new Device
{
SdkName = SdkName,
SdkVersion = SdkVersion,
OsName = OsName,
OsVersion = OsVersion,
Locale = Locale,
TimeZoneOffset = TimeZoneOffset,
AppVersion = AppVersion,
AppBuild = null,
Model = Model,
ScreenSize = ScreenSize,
OemName = OemName
};
Assert.ThrowsException<ValidationException>(() => device.Validate());
}
}

Просмотреть файл

@ -35,6 +35,6 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
{
public TestLogWithProperties() { }
public TestLogWithProperties(DateTime? timestamp, Device device, Guid? sid = default(Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(timestamp, device, sid, properties) { }
: base(device, timestamp, sid, properties) { }
}
}

Просмотреть файл

@ -38,8 +38,8 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
public void CheckInitialValuesWithServices()
{
var servicesNames = new List<string> { "Service0", "Service1", "Service2" };
var log = new StartServiceLog(null, null, servicesNames);
var log = new StartServiceLog();
log.Services = servicesNames;
Assert.IsNotNull(log.Services);
foreach (var serviceName in log.Services)
{
@ -73,21 +73,5 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
Assert.IsTrue(retrievedLog.Services.Contains(serviceName));
}
}
/// <summary>
/// Validate that log is not valid with nullable 'Services'
/// </summary>
[TestMethod]
public void ValidateStartServiceLog()
{
var log = new StartServiceLog
{
Services = null,
Device = new DeviceInformationHelper().GetDeviceInformationAsync().RunNotAsync(),
Timestamp = DateTime.Now
};
Assert.ThrowsException<ValidationException>((Action)log.Validate);
}
}
}

Просмотреть файл

@ -9,6 +9,6 @@ namespace Microsoft.AppCenter.Test.Windows.Ingestion.Models
{
public TestLog() {}
public TestLog(DateTime? timestamp, Device device, System.Guid? sid = default(System.Guid?))
: base(timestamp, device, sid){ }
: base(device, timestamp, sid) { }
}
}

Просмотреть файл

@ -9,7 +9,7 @@ set source=-Source https://www.myget.org/F/autorest/api/v2
set repoRoot=%~dp0..
set autoRestExe=%repoRoot%\packages\AutoRest.%autoRestVersion%\tools\AutoRest.exe
powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%repoRoot%\scripts\tools\nuget.exe') }"
REM powershell -command "& { (New-Object Net.WebClient).DownloadFile('https://dist.nuget.org/win-x86-commandline/latest/nuget.exe', '%repoRoot%\scripts\tools\nuget.exe') }"
%repoRoot%\scripts\tools\nuget.exe install AutoRest %source% -Version %autoRestVersion% -o %repoRoot%\packages -verbosity quiet
@echo on

Просмотреть файл

@ -0,0 +1,65 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Ingestion;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Microsoft Avalanche Ingestion REST API.
/// </summary>
public partial interface IMicrosoft.Models : System.IDisposable
{
/// <summary>
/// The base URI of the service.
/// </summary>
System.Uri BaseUri { get; set; }
/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
JsonSerializerSettings SerializationSettings { get; }
/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
JsonSerializerSettings DeserializationSettings { get; }
/// <summary>
/// API Version.
/// </summary>
string ApiVersion { get; set; }
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<Microsoft.Rest.HttpOperationResponse> SendWithHttpMessagesAsync(System.Guid appSecret, System.Guid installID, LogContainer parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}

Просмотреть файл

@ -0,0 +1,62 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion
{
using Microsoft.AppCenter;
using Microsoft.Rest;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Microsoft Avalanche Ingestion REST API.
/// </summary>
public partial interface IMicrosoft.Ingestion : System.IDisposable
{
/// <summary>
/// The base URI of the service.
/// </summary>
System.Uri BaseUri { get; set; }
/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
JsonSerializerSettings SerializationSettings { get; }
/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
JsonSerializerSettings DeserializationSettings { get; }
/// <summary>
/// API Version.
/// </summary>
string ApiVersion { get; set; }
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='customHeaders'>
/// The headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
Task<Microsoft.Rest.HttpOperationResponse> SendWithHttpMessagesAsync(System.Guid appSecret, System.Guid installID, LogContainer parameters, Dictionary<string, List<string>> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken));
}
}

Просмотреть файл

@ -0,0 +1,312 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using IMicrosoft.AppCenter;
using IMicrosoft.AppCenter.Ingestion;
using Ingestion;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
/// <summary>
/// Microsoft Avalanche Ingestion REST API.
/// </summary>
public partial class Microsoft.Models : Microsoft.Rest.ServiceClient<Microsoft.AppCenter.Ingestion.Models>, IMicrosoft.AppCenter.Ingestion.Models
{
/// <summary>
/// The base URI of the service.
/// </summary>
public System.Uri BaseUri { get; set; }
/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
public JsonSerializerSettings SerializationSettings { get; private set; }
/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
public JsonSerializerSettings DeserializationSettings { get; private set; }
/// <summary>
/// API Version.
/// </summary>
public string ApiVersion { get; set; }
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion.Models class.
/// </summary>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
public Microsoft.AppCenter.Ingestion.Models(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers)
{
this.Initialize();
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion.Models class.
/// </summary>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
public Microsoft.AppCenter.Ingestion.Models(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
this.Initialize();
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion.Models class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public Microsoft.AppCenter.Ingestion.Models(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
this.BaseUri = baseUri;
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion.Models class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public Microsoft.AppCenter.Ingestion.Models(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
this.BaseUri = baseUri;
}
/// <summary>
/// An optional partial-method to perform custom initialization.
///</summary>
partial void CustomInitialize();
/// <summary>
/// Initializes client properties.
/// </summary>
private void Initialize()
{
this.BaseUri = new System.Uri("https://avalanche.com");
SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
{
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
}
};
DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
{
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
}
};
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<Log>("type"));
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<Log>("type"));
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<CustomProperty>("type"));
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<CustomProperty>("type"));
CustomInitialize();
}
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.HttpOperationException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse> SendWithHttpMessagesAsync(System.Guid appSecret, System.Guid installID, LogContainer parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
if (this.ApiVersion == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.ApiVersion");
}
if (parameters == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
// Tracing
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
System.Collections.Generic.Dictionary<string, object> tracingParameters = new System.Collections.Generic.Dictionary<string, object>();
tracingParameters.Add("appSecret", appSecret);
tracingParameters.Add("installID", installID);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Send", tracingParameters);
}
// Construct URL
var _baseUrl = this.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "logs").ToString();
System.Collections.Generic.List<string> _queryParameters = new System.Collections.Generic.List<string>();
if (this.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += "?" + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (_httpRequest.Headers.Contains("App-Secret"))
{
_httpRequest.Headers.Remove("App-Secret");
}
_httpRequest.Headers.TryAddWithoutValidation("App-Secret", Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(appSecret, this.SerializationSettings).Trim('"'));
if (_httpRequest.Headers.Contains("Install-ID"))
{
_httpRequest.Headers.Remove("Install-ID");
}
_httpRequest.Headers.TryAddWithoutValidation("Install-ID", Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(installID, this.SerializationSettings).Trim('"'));
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.SerializationSettings);
_httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Send Request
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await this.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new Microsoft.Rest.HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
if (_httpResponse.Content != null) {
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else {
_responseContent = string.Empty;
}
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new Microsoft.Rest.HttpOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
}
}

Просмотреть файл

@ -0,0 +1,63 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Ingestion;
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Models;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Extension methods for Microsoft.AppCenter.Ingestion.Models.
/// </summary>
public static partial class Microsoft.Ingestion.ModelsExtensions
{
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
public static void Send(this IMicrosoftAppCenterIngestionModels operations, System.Guid appSecret, System.Guid installID, LogContainer parameters)
{
((IMicrosoftAppCenterIngestionModels)operations).SendAsync(appSecret, installID, parameters).GetAwaiter().GetResult();
}
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task SendAsync(this IMicrosoftAppCenterIngestionModels operations, System.Guid appSecret, System.Guid installID, LogContainer parameters, CancellationToken cancellationToken = default(CancellationToken))
{
await operations.SendWithHttpMessagesAsync(appSecret, installID, parameters, null, cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -0,0 +1,308 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion
{
using IMicrosoft.AppCenter;
using Microsoft.AppCenter;
using Microsoft.Rest;
using Microsoft.Rest.Serialization;
using Models;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Net;
using System.Net.Http;
/// <summary>
/// Microsoft Avalanche Ingestion REST API.
/// </summary>
public partial class Microsoft.Ingestion : Microsoft.Rest.ServiceClient<Microsoft.AppCenter.Ingestion>, IMicrosoft.AppCenter.Ingestion
{
/// <summary>
/// The base URI of the service.
/// </summary>
public System.Uri BaseUri { get; set; }
/// <summary>
/// Gets or sets json serialization settings.
/// </summary>
public JsonSerializerSettings SerializationSettings { get; private set; }
/// <summary>
/// Gets or sets json deserialization settings.
/// </summary>
public JsonSerializerSettings DeserializationSettings { get; private set; }
/// <summary>
/// API Version.
/// </summary>
public string ApiVersion { get; set; }
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion class.
/// </summary>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
public Microsoft.AppCenter.Ingestion(params System.Net.Http.DelegatingHandler[] handlers) : base(handlers)
{
this.Initialize();
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion class.
/// </summary>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
public Microsoft.AppCenter.Ingestion(System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : base(rootHandler, handlers)
{
this.Initialize();
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public Microsoft.AppCenter.Ingestion(System.Uri baseUri, params System.Net.Http.DelegatingHandler[] handlers) : this(handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
this.BaseUri = baseUri;
}
/// <summary>
/// Initializes a new instance of the Microsoft.AppCenter.Ingestion class.
/// </summary>
/// <param name='baseUri'>
/// Optional. The base URI of the service.
/// </param>
/// <param name='rootHandler'>
/// Optional. The http client handler used to handle http transport.
/// </param>
/// <param name='handlers'>
/// Optional. The delegating handlers to add to the http client pipeline.
/// </param>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
public Microsoft.AppCenter.Ingestion(System.Uri baseUri, System.Net.Http.HttpClientHandler rootHandler, params System.Net.Http.DelegatingHandler[] handlers) : this(rootHandler, handlers)
{
if (baseUri == null)
{
throw new System.ArgumentNullException("baseUri");
}
this.BaseUri = baseUri;
}
/// <summary>
/// An optional partial-method to perform custom initialization.
///</summary>
partial void CustomInitialize();
/// <summary>
/// Initializes client properties.
/// </summary>
private void Initialize()
{
this.BaseUri = new System.Uri("https://avalanche.com");
SerializationSettings = new Newtonsoft.Json.JsonSerializerSettings
{
Formatting = Newtonsoft.Json.Formatting.Indented,
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
{
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
}
};
DeserializationSettings = new Newtonsoft.Json.JsonSerializerSettings
{
DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat,
DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc,
NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore,
ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize,
ContractResolver = new Microsoft.Rest.Serialization.ReadOnlyJsonContractResolver(),
Converters = new System.Collections.Generic.List<Newtonsoft.Json.JsonConverter>
{
new Microsoft.Rest.Serialization.Iso8601TimeSpanConverter()
}
};
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<Log>("type"));
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<Log>("type"));
SerializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicSerializeJsonConverter<CustomProperty>("type"));
DeserializationSettings.Converters.Add(new Microsoft.Rest.Serialization.PolymorphicDeserializeJsonConverter<CustomProperty>("type"));
CustomInitialize();
}
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='customHeaders'>
/// Headers that will be added to request.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
/// <exception cref="Microsoft.Rest.HttpOperationException">
/// Thrown when the operation returned an invalid status code
/// </exception>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown when a required parameter is null
/// </exception>
/// <exception cref="System.ArgumentNullException">
/// Thrown when a required parameter is null
/// </exception>
/// <return>
/// A response object containing the response body and response headers.
/// </return>
public async System.Threading.Tasks.Task<Microsoft.Rest.HttpOperationResponse> SendWithHttpMessagesAsync(System.Guid appSecret, System.Guid installID, LogContainer parameters, System.Collections.Generic.Dictionary<string, System.Collections.Generic.List<string>> customHeaders = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken))
{
if (this.ApiVersion == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "this.ApiVersion");
}
if (parameters == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "parameters");
}
if (parameters != null)
{
parameters.Validate();
}
// Tracing
bool _shouldTrace = Microsoft.Rest.ServiceClientTracing.IsEnabled;
string _invocationId = null;
if (_shouldTrace)
{
_invocationId = Microsoft.Rest.ServiceClientTracing.NextInvocationId.ToString();
System.Collections.Generic.Dictionary<string, object> tracingParameters = new System.Collections.Generic.Dictionary<string, object>();
tracingParameters.Add("appSecret", appSecret);
tracingParameters.Add("installID", installID);
tracingParameters.Add("parameters", parameters);
tracingParameters.Add("cancellationToken", cancellationToken);
Microsoft.Rest.ServiceClientTracing.Enter(_invocationId, this, "Send", tracingParameters);
}
// Construct URL
var _baseUrl = this.BaseUri.AbsoluteUri;
var _url = new System.Uri(new System.Uri(_baseUrl + (_baseUrl.EndsWith("/") ? "" : "/")), "logs").ToString();
System.Collections.Generic.List<string> _queryParameters = new System.Collections.Generic.List<string>();
if (this.ApiVersion != null)
{
_queryParameters.Add(string.Format("api-version={0}", System.Uri.EscapeDataString(this.ApiVersion)));
}
if (_queryParameters.Count > 0)
{
_url += "?" + string.Join("&", _queryParameters);
}
// Create HTTP transport objects
var _httpRequest = new System.Net.Http.HttpRequestMessage();
System.Net.Http.HttpResponseMessage _httpResponse = null;
_httpRequest.Method = new System.Net.Http.HttpMethod("POST");
_httpRequest.RequestUri = new System.Uri(_url);
// Set Headers
if (_httpRequest.Headers.Contains("App-Secret"))
{
_httpRequest.Headers.Remove("App-Secret");
}
_httpRequest.Headers.TryAddWithoutValidation("App-Secret", Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(appSecret, this.SerializationSettings).Trim('"'));
if (_httpRequest.Headers.Contains("Install-ID"))
{
_httpRequest.Headers.Remove("Install-ID");
}
_httpRequest.Headers.TryAddWithoutValidation("Install-ID", Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(installID, this.SerializationSettings).Trim('"'));
if (customHeaders != null)
{
foreach(var _header in customHeaders)
{
if (_httpRequest.Headers.Contains(_header.Key))
{
_httpRequest.Headers.Remove(_header.Key);
}
_httpRequest.Headers.TryAddWithoutValidation(_header.Key, _header.Value);
}
}
// Serialize Request
string _requestContent = null;
if(parameters != null)
{
_requestContent = Microsoft.Rest.Serialization.SafeJsonConvert.SerializeObject(parameters, this.SerializationSettings);
_httpRequest.Content = new System.Net.Http.StringContent(_requestContent, System.Text.Encoding.UTF8);
_httpRequest.Content.Headers.ContentType =System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json; charset=utf-8");
}
// Send Request
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.SendRequest(_invocationId, _httpRequest);
}
cancellationToken.ThrowIfCancellationRequested();
_httpResponse = await this.HttpClient.SendAsync(_httpRequest, cancellationToken).ConfigureAwait(false);
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.ReceiveResponse(_invocationId, _httpResponse);
}
System.Net.HttpStatusCode _statusCode = _httpResponse.StatusCode;
cancellationToken.ThrowIfCancellationRequested();
string _responseContent = null;
if ((int)_statusCode != 200)
{
var ex = new Microsoft.Rest.HttpOperationException(string.Format("Operation returned an invalid status code '{0}'", _statusCode));
if (_httpResponse.Content != null) {
_responseContent = await _httpResponse.Content.ReadAsStringAsync().ConfigureAwait(false);
}
else {
_responseContent = string.Empty;
}
ex.Request = new Microsoft.Rest.HttpRequestMessageWrapper(_httpRequest, _requestContent);
ex.Response = new Microsoft.Rest.HttpResponseMessageWrapper(_httpResponse, _responseContent);
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.Error(_invocationId, ex);
}
_httpRequest.Dispose();
if (_httpResponse != null)
{
_httpResponse.Dispose();
}
throw ex;
}
// Create Result
var _result = new Microsoft.Rest.HttpOperationResponse();
_result.Request = _httpRequest;
_result.Response = _httpResponse;
if (_shouldTrace)
{
Microsoft.Rest.ServiceClientTracing.Exit(_invocationId, _result);
}
return _result;
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion
{
using Microsoft.AppCenter;
using Models;
using System.Threading;
using System.Threading.Tasks;
/// <summary>
/// Extension methods for Microsoft.AppCenter.Ingestion.
/// </summary>
public static partial class Microsoft.AppCenter.IngestionExtensions
{
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
public static void Send(this IMicrosoftAppCenterIngestion operations, System.Guid appSecret, System.Guid installID, LogContainer parameters)
{
((IMicrosoftAppCenterIngestion)operations).SendAsync(appSecret, installID, parameters).GetAwaiter().GetResult();
}
/// <summary>
/// Send logs to the Ingestion service.
/// </summary>
/// <param name='operations'>
/// The operations group for this extension method.
/// </param>
/// <param name='appSecret'>
/// A unique and secret key used to identify the application.
/// </param>
/// <param name='installID'>
/// Installation identifier.
/// </param>
/// <param name='parameters'>
/// Payload.
/// </param>
/// <param name='cancellationToken'>
/// The cancellation token.
/// </param>
public static async Task SendAsync(this IMicrosoftAppCenterIngestion operations, System.Guid appSecret, System.Guid installID, LogContainer parameters, CancellationToken cancellationToken = default(CancellationToken))
{
await operations.SendWithHttpMessagesAsync(appSecret, installID, parameters, null, cancellationToken).ConfigureAwait(false);
}
}
}

Просмотреть файл

@ -0,0 +1,145 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Abstract error log.
/// </summary>
public partial class AbstractErrorLog : Log
{
/// <summary>
/// Initializes a new instance of the AbstractErrorLog class.
/// </summary>
public AbstractErrorLog() { }
/// <summary>
/// Initializes a new instance of the AbstractErrorLog class.
/// </summary>
/// <param name="id">Error identifier.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="processName">Process name.</param>
/// <param name="fatal">If true, this error report is an application
/// crash.
/// Corresponds to the number of milliseconds elapsed between the time
/// the error occurred and the app was launched.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="parentProcessId">Parent's process identifier.</param>
/// <param name="parentProcessName">Parent's process name.</param>
/// <param name="errorThreadId">Error thread identifier.</param>
/// <param name="errorThreadName">Error thread name.</param>
/// <param name="appLaunchTimestamp">Timestamp when the app was
/// launched, example: '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="architecture">CPU architecture.</param>
public AbstractErrorLog(Device device, System.Guid id, int processId, string processName, bool fatal, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), int? parentProcessId = default(int?), string parentProcessName = default(string), long? errorThreadId = default(long?), string errorThreadName = default(string), System.DateTime? appLaunchTimestamp = default(System.DateTime?), string architecture = default(string))
: base(device, timestamp, sid)
{
Id = id;
ProcessId = processId;
ProcessName = processName;
ParentProcessId = parentProcessId;
ParentProcessName = parentProcessName;
ErrorThreadId = errorThreadId;
ErrorThreadName = errorThreadName;
Fatal = fatal;
AppLaunchTimestamp = appLaunchTimestamp;
Architecture = architecture;
}
/// <summary>
/// Gets or sets error identifier.
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid Id { get; set; }
/// <summary>
/// Gets or sets process identifier.
/// </summary>
[JsonProperty(PropertyName = "processId")]
public int ProcessId { get; set; }
/// <summary>
/// Gets or sets process name.
/// </summary>
[JsonProperty(PropertyName = "processName")]
public string ProcessName { get; set; }
/// <summary>
/// Gets or sets parent's process identifier.
/// </summary>
[JsonProperty(PropertyName = "parentProcessId")]
public int? ParentProcessId { get; set; }
/// <summary>
/// Gets or sets parent's process name.
/// </summary>
[JsonProperty(PropertyName = "parentProcessName")]
public string ParentProcessName { get; set; }
/// <summary>
/// Gets or sets error thread identifier.
/// </summary>
[JsonProperty(PropertyName = "errorThreadId")]
public long? ErrorThreadId { get; set; }
/// <summary>
/// Gets or sets error thread name.
/// </summary>
[JsonProperty(PropertyName = "errorThreadName")]
public string ErrorThreadName { get; set; }
/// <summary>
/// Gets or sets if true, this error report is an application crash.
/// Corresponds to the number of milliseconds elapsed between the time
/// the error occurred and the app was launched.
/// </summary>
[JsonProperty(PropertyName = "fatal")]
public bool Fatal { get; set; }
/// <summary>
/// Gets or sets timestamp when the app was launched, example:
/// '2017-03-13T18:05:42Z'.
///
/// </summary>
[JsonProperty(PropertyName = "appLaunchTimestamp")]
public System.DateTime? AppLaunchTimestamp { get; set; }
/// <summary>
/// Gets or sets CPU architecture.
/// </summary>
[JsonProperty(PropertyName = "architecture")]
public string Architecture { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (ProcessName == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ProcessName");
}
}
}
}

Просмотреть файл

@ -0,0 +1,225 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Error log for Apple platforms.
/// </summary>
[JsonObject("appleError")]
public partial class AppleErrorLog : AbstractErrorLog
{
/// <summary>
/// Initializes a new instance of the AppleErrorLog class.
/// </summary>
public AppleErrorLog() { }
/// <summary>
/// Initializes a new instance of the AppleErrorLog class.
/// </summary>
/// <param name="id">Error identifier.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="processName">Process name.</param>
/// <param name="fatal">If true, this error report is an application
/// crash.
/// Corresponds to the number of milliseconds elapsed between the time
/// the error occurred and the app was launched.</param>
/// <param name="primaryArchitectureId">CPU primary
/// architecture.</param>
/// <param name="applicationPath">Path to the application.</param>
/// <param name="osExceptionType">OS exception type.</param>
/// <param name="osExceptionCode">OS exception code.</param>
/// <param name="osExceptionAddress">OS exception address.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="parentProcessId">Parent's process identifier.</param>
/// <param name="parentProcessName">Parent's process name.</param>
/// <param name="errorThreadId">Error thread identifier.</param>
/// <param name="errorThreadName">Error thread name.</param>
/// <param name="appLaunchTimestamp">Timestamp when the app was
/// launched, example: '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="architecture">CPU architecture.</param>
/// <param name="architectureVariantId">CPU architecture
/// variant.</param>
/// <param name="exceptionType">Exception type.</param>
/// <param name="exceptionReason">Exception reason.</param>
/// <param name="selectorRegisterValue">Content of register that might
/// contain last method call.</param>
/// <param name="threads">Thread stack frames associated to the
/// error.</param>
/// <param name="binaries">Binaries associated to the error.</param>
/// <param name="registers">Registers.</param>
/// <param name="exception">Exception associated to the error.
/// This is used for example to send a .NET exception from the Xamarin
/// SDK.
/// </param>
public AppleErrorLog(Device device, System.Guid id, int processId, string processName, bool fatal, long primaryArchitectureId, string applicationPath, string osExceptionType, string osExceptionCode, string osExceptionAddress, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), int? parentProcessId = default(int?), string parentProcessName = default(string), long? errorThreadId = default(long?), string errorThreadName = default(string), System.DateTime? appLaunchTimestamp = default(System.DateTime?), string architecture = default(string), long? architectureVariantId = default(long?), string exceptionType = default(string), string exceptionReason = default(string), string selectorRegisterValue = default(string), IList<Thread> threads = default(IList<Thread>), IList<Binary> binaries = default(IList<Binary>), IDictionary<string, string> registers = default(IDictionary<string, string>), Exception exception = default(Exception))
: base(device, id, processId, processName, fatal, timestamp, sid, parentProcessId, parentProcessName, errorThreadId, errorThreadName, appLaunchTimestamp, architecture)
{
PrimaryArchitectureId = primaryArchitectureId;
ArchitectureVariantId = architectureVariantId;
ApplicationPath = applicationPath;
OsExceptionType = osExceptionType;
OsExceptionCode = osExceptionCode;
OsExceptionAddress = osExceptionAddress;
ExceptionType = exceptionType;
ExceptionReason = exceptionReason;
SelectorRegisterValue = selectorRegisterValue;
Threads = threads;
Binaries = binaries;
Registers = registers;
Exception = exception;
}
/// <summary>
/// Gets or sets CPU primary architecture.
/// </summary>
[JsonProperty(PropertyName = "primaryArchitectureId")]
public long PrimaryArchitectureId { get; set; }
/// <summary>
/// Gets or sets CPU architecture variant.
/// </summary>
[JsonProperty(PropertyName = "architectureVariantId")]
public long? ArchitectureVariantId { get; set; }
/// <summary>
/// Gets or sets path to the application.
/// </summary>
[JsonProperty(PropertyName = "applicationPath")]
public string ApplicationPath { get; set; }
/// <summary>
/// Gets or sets OS exception type.
/// </summary>
[JsonProperty(PropertyName = "osExceptionType")]
public string OsExceptionType { get; set; }
/// <summary>
/// Gets or sets OS exception code.
/// </summary>
[JsonProperty(PropertyName = "osExceptionCode")]
public string OsExceptionCode { get; set; }
/// <summary>
/// Gets or sets OS exception address.
/// </summary>
[JsonProperty(PropertyName = "osExceptionAddress")]
public string OsExceptionAddress { get; set; }
/// <summary>
/// Gets or sets exception type.
/// </summary>
[JsonProperty(PropertyName = "exceptionType")]
public string ExceptionType { get; set; }
/// <summary>
/// Gets or sets exception reason.
/// </summary>
[JsonProperty(PropertyName = "exceptionReason")]
public string ExceptionReason { get; set; }
/// <summary>
/// Gets or sets content of register that might contain last method
/// call.
/// </summary>
[JsonProperty(PropertyName = "selectorRegisterValue")]
public string SelectorRegisterValue { get; set; }
/// <summary>
/// Gets or sets thread stack frames associated to the error.
/// </summary>
[JsonProperty(PropertyName = "threads")]
public IList<Thread> Threads { get; set; }
/// <summary>
/// Gets or sets binaries associated to the error.
/// </summary>
[JsonProperty(PropertyName = "binaries")]
public IList<Binary> Binaries { get; set; }
/// <summary>
/// Gets or sets registers.
/// </summary>
[JsonProperty(PropertyName = "registers")]
public IDictionary<string, string> Registers { get; set; }
/// <summary>
/// Gets or sets exception associated to the error.
/// This is used for example to send a .NET exception from the Xamarin
/// SDK.
///
/// </summary>
[JsonProperty(PropertyName = "exception")]
public Exception Exception { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (ApplicationPath == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ApplicationPath");
}
if (OsExceptionType == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OsExceptionType");
}
if (OsExceptionCode == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OsExceptionCode");
}
if (OsExceptionAddress == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OsExceptionAddress");
}
if (Threads != null)
{
foreach (var element in Threads)
{
if (element != null)
{
element.Validate();
}
}
}
if (Binaries != null)
{
foreach (var element1 in Binaries)
{
if (element1 != null)
{
element1.Validate();
}
}
}
if (Exception != null)
{
Exception.Validate();
}
}
}
}

Просмотреть файл

@ -0,0 +1,109 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Binary (library) definition for any platform.
/// </summary>
public partial class Binary
{
/// <summary>
/// Initializes a new instance of the Binary class.
/// </summary>
public Binary() { }
/// <summary>
/// Initializes a new instance of the Binary class.
/// </summary>
/// <param name="primaryArchitectureId">CPU primary
/// architecture.</param>
/// <param name="architectureVariantId">CPU architecture
/// variant.</param>
public Binary(System.Guid id, string startAddress, string endAddress, string name, string path, string architecture = default(string), long? primaryArchitectureId = default(long?), long? architectureVariantId = default(long?))
{
Id = id;
StartAddress = startAddress;
EndAddress = endAddress;
Name = name;
Path = path;
Architecture = architecture;
PrimaryArchitectureId = primaryArchitectureId;
ArchitectureVariantId = architectureVariantId;
}
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid Id { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "startAddress")]
public string StartAddress { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "endAddress")]
public string EndAddress { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "path")]
public string Path { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "architecture")]
public string Architecture { get; set; }
/// <summary>
/// Gets or sets CPU primary architecture.
/// </summary>
[JsonProperty(PropertyName = "primaryArchitectureId")]
public long? PrimaryArchitectureId { get; set; }
/// <summary>
/// Gets or sets CPU architecture variant.
/// </summary>
[JsonProperty(PropertyName = "architectureVariantId")]
public long? ArchitectureVariantId { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (StartAddress == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "StartAddress");
}
if (EndAddress == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "EndAddress");
}
if (Name == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name");
}
if (Path == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Path");
}
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Boolean property.
/// </summary>
[JsonObject("boolean")]
public partial class BooleanProperty : CustomProperty
{
/// <summary>
/// Initializes a new instance of the BooleanProperty class.
/// </summary>
public BooleanProperty() { }
/// <summary>
/// Initializes a new instance of the BooleanProperty class.
/// </summary>
/// <param name="value">Boolean property value.</param>
public BooleanProperty(string name, bool value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets boolean property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public bool Value { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,41 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Clear an existing property.
/// </summary>
[JsonObject("clear")]
public partial class ClearProperty : CustomProperty
{
/// <summary>
/// Initializes a new instance of the ClearProperty class.
/// </summary>
public ClearProperty() { }
/// <summary>
/// Initializes a new instance of the ClearProperty class.
/// </summary>
public ClearProperty(string name)
: base(name)
{
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,57 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
public partial class CustomProperty
{
/// <summary>
/// Initializes a new instance of the CustomProperty class.
/// </summary>
public CustomProperty() { }
/// <summary>
/// Initializes a new instance of the CustomProperty class.
/// </summary>
public CustomProperty(string name)
{
Name = name;
}
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Name == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name");
}
if (Name != null)
{
if (Name.Length > 128)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Name", 128);
}
if (!System.Text.RegularExpressions.Regex.IsMatch(Name, "^[a-zA-Z][a-zA-Z0-9\\-_]*$"))
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.Pattern, "Name", "^[a-zA-Z][a-zA-Z0-9\\-_]*$");
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,81 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Set or remove custom properties.
/// </summary>
[JsonObject("customProperties")]
public partial class CustomPropertyLog : Log
{
/// <summary>
/// Initializes a new instance of the CustomPropertyLog class.
/// </summary>
public CustomPropertyLog() { }
/// <summary>
/// Initializes a new instance of the CustomPropertyLog class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Custom property changes.</param>
public CustomPropertyLog(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IList<CustomProperty> properties = default(IList<CustomProperty>))
: base(device, timestamp, sid)
{
Properties = properties;
}
/// <summary>
/// Gets or sets custom property changes.
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IList<CustomProperty> Properties { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Properties != null)
{
if (Properties.Count > 60)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxItems, "Properties", 60);
}
if (Properties.Count < 1)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinItems, "Properties", 1);
}
foreach (var element in Properties)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Date and time property.
/// </summary>
[JsonObject("dateTime")]
public partial class DateTimeProperty : CustomProperty
{
/// <summary>
/// Initializes a new instance of the DateTimeProperty class.
/// </summary>
public DateTimeProperty() { }
/// <summary>
/// Initializes a new instance of the DateTimeProperty class.
/// </summary>
/// <param name="value">Date time property value.</param>
public DateTimeProperty(string name, System.DateTime value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets date time property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public System.DateTime Value { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,342 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Device characteristics.
/// </summary>
public partial class Device
{
/// <summary>
/// Initializes a new instance of the Device class.
/// </summary>
public Device() { }
/// <summary>
/// Initializes a new instance of the Device class.
/// </summary>
/// <param name="sdkName">Name of the SDK. Consists of the name of the
/// SDK and the platform, e.g. "mobilecenter.ios", "hockeysdk.android".
/// </param>
/// <param name="sdkVersion">Version of the SDK in semver format, e.g.
/// "1.2.0" or "0.12.3-alpha.1".
/// </param>
/// <param name="osName">OS name (example: iOS). The following OS names
/// are standardized (non-exclusive): Android, iOS, macOS, tvOS,
/// Windows.
/// </param>
/// <param name="osVersion">OS version (example: 9.3.0).
/// </param>
/// <param name="locale">Language code (example: en-US).
/// </param>
/// <param name="timeZoneOffset">The offset in minutes from UTC for the
/// device time zone, including daylight savings time.
/// </param>
/// <param name="appVersion">Application version name, e.g. 1.1.0
/// </param>
/// <param name="appBuild">The app's build number, e.g. 42.
/// </param>
/// <param name="wrapperSdkVersion">Version of the wrapper SDK in
/// semver format. When the SDK is embedding another base SDK (for
/// example Xamarin.Android wraps Android), the Xamarin specific
/// version is populated into this field while sdkVersion refers to the
/// original Android SDK.
/// </param>
/// <param name="wrapperSdkName">Name of the wrapper SDK. Consists of
/// the name of the SDK and the wrapper platform, e.g.
/// "mobilecenter.xamarin", "hockeysdk.cordova".
/// </param>
/// <param name="model">Device model (example: iPad2,3).
/// </param>
/// <param name="oemName">Device manufacturer (example: HTC).
/// </param>
/// <param name="osBuild">OS build code (example: LMY47X).
/// </param>
/// <param name="osApiLevel">API level when applicable like in Android
/// (example: 15).
/// </param>
/// <param name="screenSize">Screen size of the device in pixels
/// (example: 640x480).
/// </param>
/// <param name="carrierName">Carrier name (for mobile devices).
/// </param>
/// <param name="carrierCountry">Carrier country code (for mobile
/// devices).
/// </param>
/// <param name="appNamespace">The bundle identifier, package
/// identifier, or namespace, depending on what the individual
/// plattforms use, .e.g com.microsoft.example.
/// </param>
/// <param name="liveUpdateReleaseLabel">Label that is used to identify
/// application code 'version' released via Live Update beacon running
/// on device
/// </param>
/// <param name="liveUpdateDeploymentKey">Identifier of environment
/// that current application release belongs to, deployment key then
/// maps to environment like Production, Staging.
/// </param>
/// <param name="liveUpdatePackageHash">Hash of all files (ReactNative
/// or Cordova) deployed to device via LiveUpdate beacon. Helps
/// identify the Release version on device or need to download updates
/// in future.
/// </param>
/// <param name="wrapperRuntimeVersion">Version of the wrapper
/// technology framework (Xamarin runtime version or ReactNative or
/// Cordova etc...). See wrappersdkname to see if this version refers
/// to Xamarin or ReactNative or other.
/// </param>
public Device(string sdkName, string sdkVersion, string osName, string osVersion, string locale, int timeZoneOffset, string appVersion, string appBuild, string wrapperSdkVersion = default(string), string wrapperSdkName = default(string), string model = default(string), string oemName = default(string), string osBuild = default(string), int? osApiLevel = default(int?), string screenSize = default(string), string carrierName = default(string), string carrierCountry = default(string), string appNamespace = default(string), string liveUpdateReleaseLabel = default(string), string liveUpdateDeploymentKey = default(string), string liveUpdatePackageHash = default(string), string wrapperRuntimeVersion = default(string))
{
SdkName = sdkName;
SdkVersion = sdkVersion;
WrapperSdkVersion = wrapperSdkVersion;
WrapperSdkName = wrapperSdkName;
Model = model;
OemName = oemName;
OsName = osName;
OsVersion = osVersion;
OsBuild = osBuild;
OsApiLevel = osApiLevel;
Locale = locale;
TimeZoneOffset = timeZoneOffset;
ScreenSize = screenSize;
AppVersion = appVersion;
CarrierName = carrierName;
CarrierCountry = carrierCountry;
AppBuild = appBuild;
AppNamespace = appNamespace;
LiveUpdateReleaseLabel = liveUpdateReleaseLabel;
LiveUpdateDeploymentKey = liveUpdateDeploymentKey;
LiveUpdatePackageHash = liveUpdatePackageHash;
WrapperRuntimeVersion = wrapperRuntimeVersion;
}
/// <summary>
/// Gets or sets name of the SDK. Consists of the name of the SDK and
/// the platform, e.g. "mobilecenter.ios", "hockeysdk.android".
///
/// </summary>
[JsonProperty(PropertyName = "sdkName")]
public string SdkName { get; set; }
/// <summary>
/// Gets or sets version of the SDK in semver format, e.g. "1.2.0" or
/// "0.12.3-alpha.1".
///
/// </summary>
[JsonProperty(PropertyName = "sdkVersion")]
public string SdkVersion { get; set; }
/// <summary>
/// Gets or sets version of the wrapper SDK in semver format. When the
/// SDK is embedding another base SDK (for example Xamarin.Android
/// wraps Android), the Xamarin specific version is populated into this
/// field while sdkVersion refers to the original Android SDK.
///
/// </summary>
[JsonProperty(PropertyName = "wrapperSdkVersion")]
public string WrapperSdkVersion { get; set; }
/// <summary>
/// Gets or sets name of the wrapper SDK. Consists of the name of the
/// SDK and the wrapper platform, e.g. "mobilecenter.xamarin",
/// "hockeysdk.cordova".
///
/// </summary>
[JsonProperty(PropertyName = "wrapperSdkName")]
public string WrapperSdkName { get; set; }
/// <summary>
/// Gets or sets device model (example: iPad2,3).
///
/// </summary>
[JsonProperty(PropertyName = "model")]
public string Model { get; set; }
/// <summary>
/// Gets or sets device manufacturer (example: HTC).
///
/// </summary>
[JsonProperty(PropertyName = "oemName")]
public string OemName { get; set; }
/// <summary>
/// Gets or sets OS name (example: iOS). The following OS names are
/// standardized (non-exclusive): Android, iOS, macOS, tvOS, Windows.
///
/// </summary>
[JsonProperty(PropertyName = "osName")]
public string OsName { get; set; }
/// <summary>
/// Gets or sets OS version (example: 9.3.0).
///
/// </summary>
[JsonProperty(PropertyName = "osVersion")]
public string OsVersion { get; set; }
/// <summary>
/// Gets or sets OS build code (example: LMY47X).
///
/// </summary>
[JsonProperty(PropertyName = "osBuild")]
public string OsBuild { get; set; }
/// <summary>
/// Gets or sets API level when applicable like in Android (example:
/// 15).
///
/// </summary>
[JsonProperty(PropertyName = "osApiLevel")]
public int? OsApiLevel { get; set; }
/// <summary>
/// Gets or sets language code (example: en-US).
///
/// </summary>
[JsonProperty(PropertyName = "locale")]
public string Locale { get; set; }
/// <summary>
/// Gets or sets the offset in minutes from UTC for the device time
/// zone, including daylight savings time.
///
/// </summary>
[JsonProperty(PropertyName = "timeZoneOffset")]
public int TimeZoneOffset { get; set; }
/// <summary>
/// Gets or sets screen size of the device in pixels (example:
/// 640x480).
///
/// </summary>
[JsonProperty(PropertyName = "screenSize")]
public string ScreenSize { get; set; }
/// <summary>
/// Gets or sets application version name, e.g. 1.1.0
///
/// </summary>
[JsonProperty(PropertyName = "appVersion")]
public string AppVersion { get; set; }
/// <summary>
/// Gets or sets carrier name (for mobile devices).
///
/// </summary>
[JsonProperty(PropertyName = "carrierName")]
public string CarrierName { get; set; }
/// <summary>
/// Gets or sets carrier country code (for mobile devices).
///
/// </summary>
[JsonProperty(PropertyName = "carrierCountry")]
public string CarrierCountry { get; set; }
/// <summary>
/// Gets or sets the app's build number, e.g. 42.
///
/// </summary>
[JsonProperty(PropertyName = "appBuild")]
public string AppBuild { get; set; }
/// <summary>
/// Gets or sets the bundle identifier, package identifier, or
/// namespace, depending on what the individual plattforms use, .e.g
/// com.microsoft.example.
///
/// </summary>
[JsonProperty(PropertyName = "appNamespace")]
public string AppNamespace { get; set; }
/// <summary>
/// Gets or sets label that is used to identify application code
/// 'version' released via Live Update beacon running on device
///
/// </summary>
[JsonProperty(PropertyName = "liveUpdateReleaseLabel")]
public string LiveUpdateReleaseLabel { get; set; }
/// <summary>
/// Gets or sets identifier of environment that current application
/// release belongs to, deployment key then maps to environment like
/// Production, Staging.
///
/// </summary>
[JsonProperty(PropertyName = "liveUpdateDeploymentKey")]
public string LiveUpdateDeploymentKey { get; set; }
/// <summary>
/// Gets or sets hash of all files (ReactNative or Cordova) deployed to
/// device via LiveUpdate beacon. Helps identify the Release version on
/// device or need to download updates in future.
///
/// </summary>
[JsonProperty(PropertyName = "liveUpdatePackageHash")]
public string LiveUpdatePackageHash { get; set; }
/// <summary>
/// Gets or sets version of the wrapper technology framework (Xamarin
/// runtime version or ReactNative or Cordova etc...). See
/// wrappersdkname to see if this version refers to Xamarin or
/// ReactNative or other.
///
/// </summary>
[JsonProperty(PropertyName = "wrapperRuntimeVersion")]
public string WrapperRuntimeVersion { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (SdkName == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "SdkName");
}
if (SdkVersion == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "SdkVersion");
}
if (OsName == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OsName");
}
if (OsVersion == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "OsVersion");
}
if (Locale == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Locale");
}
if (AppVersion == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AppVersion");
}
if (AppBuild == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "AppBuild");
}
if (TimeZoneOffset > 840)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMaximum, "TimeZoneOffset", 840);
}
if (TimeZoneOffset < -840)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.InclusiveMinimum, "TimeZoneOffset", -840);
}
}
}
}

Просмотреть файл

@ -0,0 +1,103 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Error attachment log.
/// </summary>
[JsonObject("errorAttachment")]
public partial class ErrorAttachmentLog : Log
{
/// <summary>
/// Initializes a new instance of the ErrorAttachmentLog class.
/// </summary>
public ErrorAttachmentLog() { }
/// <summary>
/// Initializes a new instance of the ErrorAttachmentLog class.
/// </summary>
/// <param name="id">Error attachment identifier.</param>
/// <param name="errorId">Error log identifier to attach this log
/// to.</param>
/// <param name="contentType">Content type (text/plain for
/// text).</param>
/// <param name="data">Data encoded as base 64.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="fileName">File name.</param>
public ErrorAttachmentLog(Device device, System.Guid id, System.Guid errorId, string contentType, byte[] data, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), string fileName = default(string))
: base(device, timestamp, sid)
{
Id = id;
ErrorId = errorId;
ContentType = contentType;
FileName = fileName;
Data = data;
}
/// <summary>
/// Gets or sets error attachment identifier.
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid Id { get; set; }
/// <summary>
/// Gets or sets error log identifier to attach this log to.
/// </summary>
[JsonProperty(PropertyName = "errorId")]
public System.Guid ErrorId { get; set; }
/// <summary>
/// Gets or sets content type (text/plain for text).
/// </summary>
[JsonProperty(PropertyName = "contentType")]
public string ContentType { get; set; }
/// <summary>
/// Gets or sets file name.
/// </summary>
[JsonProperty(PropertyName = "fileName")]
public string FileName { get; set; }
/// <summary>
/// Gets or sets data encoded as base 64.
/// </summary>
[JsonProperty(PropertyName = "data")]
public byte[] Data { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (ContentType == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "ContentType");
}
if (Data == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Data");
}
}
}
}

Просмотреть файл

@ -0,0 +1,88 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Event log.
/// </summary>
[JsonObject("event")]
public partial class EventLog : LogWithProperties
{
/// <summary>
/// Initializes a new instance of the EventLog class.
/// </summary>
public EventLog() { }
/// <summary>
/// Initializes a new instance of the EventLog class.
/// </summary>
/// <param name="id">Unique identifier for this event.
/// </param>
/// <param name="name">Name of the event.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public EventLog(Device device, System.Guid id, string name, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid, properties)
{
Id = id;
Name = name;
}
/// <summary>
/// Gets or sets unique identifier for this event.
///
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid Id { get; set; }
/// <summary>
/// Gets or sets name of the event.
///
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Name == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name");
}
if (Name != null)
{
if (Name.Length > 256)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Name", 256);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,112 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Exception definition for any platform.
/// </summary>
public partial class Exception
{
/// <summary>
/// Initializes a new instance of the Exception class.
/// </summary>
public Exception() { }
/// <summary>
/// Initializes a new instance of the Exception class.
/// </summary>
/// <param name="type">Exception type.</param>
/// <param name="message">Exception reason.</param>
/// <param name="stackTrace">Raw stack trace. Sent when the frames
/// property is either missing or unreliable.</param>
/// <param name="frames">Stack frames. Optional.</param>
/// <param name="innerExceptions">Inner exceptions of this
/// exception.</param>
/// <param name="wrapperSdkName">Name of the wrapper SDK that emitted
/// this exeption. Consists of the name of the SDK and the wrapper
/// platform, e.g. "mobilecenter.xamarin", "hockeysdk.cordova".
/// </param>
public Exception(string type, string message = default(string), string stackTrace = default(string), IList<StackFrame> frames = default(IList<StackFrame>), IList<Exception> innerExceptions = default(IList<Exception>), string wrapperSdkName = default(string))
{
Type = type;
Message = message;
StackTrace = stackTrace;
Frames = frames;
InnerExceptions = innerExceptions;
WrapperSdkName = wrapperSdkName;
}
/// <summary>
/// Gets or sets exception type.
/// </summary>
[JsonProperty(PropertyName = "type")]
public string Type { get; set; }
/// <summary>
/// Gets or sets exception reason.
/// </summary>
[JsonProperty(PropertyName = "message")]
public string Message { get; set; }
/// <summary>
/// Gets or sets raw stack trace. Sent when the frames property is
/// either missing or unreliable.
/// </summary>
[JsonProperty(PropertyName = "stackTrace")]
public string StackTrace { get; set; }
/// <summary>
/// Gets or sets stack frames. Optional.
/// </summary>
[JsonProperty(PropertyName = "frames")]
public IList<StackFrame> Frames { get; set; }
/// <summary>
/// Gets or sets inner exceptions of this exception.
/// </summary>
[JsonProperty(PropertyName = "innerExceptions")]
public IList<Exception> InnerExceptions { get; set; }
/// <summary>
/// Gets or sets name of the wrapper SDK that emitted this exeption.
/// Consists of the name of the SDK and the wrapper platform, e.g.
/// "mobilecenter.xamarin", "hockeysdk.cordova".
///
/// </summary>
[JsonProperty(PropertyName = "wrapperSdkName")]
public string WrapperSdkName { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Type == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Type");
}
if (InnerExceptions != null)
{
foreach (var element in InnerExceptions)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,80 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Handled Error log for managed platforms (such as Xamarin, Unity,
/// Android Dalvik/ART)
/// </summary>
[JsonObject("handledError")]
public partial class HandledErrorLog : Log
{
/// <summary>
/// Initializes a new instance of the HandledErrorLog class.
/// </summary>
public HandledErrorLog() { }
/// <summary>
/// Initializes a new instance of the HandledErrorLog class.
/// </summary>
/// <param name="exception">Exception associated to the error.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="id">Unique identifier for this Error.
/// </param>
public HandledErrorLog(Device device, Exception exception, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), System.Guid? id = default(System.Guid?))
: base(device, timestamp, sid)
{
Id = id;
Exception = exception;
}
/// <summary>
/// Gets or sets unique identifier for this Error.
///
/// </summary>
[JsonProperty(PropertyName = "id")]
public System.Guid? Id { get; set; }
/// <summary>
/// Gets or sets exception associated to the error.
/// </summary>
[JsonProperty(PropertyName = "exception")]
public Exception Exception { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Exception == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Exception");
}
if (Exception != null)
{
Exception.Validate();
}
}
}
}

Просмотреть файл

@ -0,0 +1,83 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
public partial class Log
{
/// <summary>
/// Initializes a new instance of the Log class.
/// </summary>
public Log() { }
/// <summary>
/// Initializes a new instance of the Log class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
public Log(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?))
{
Timestamp = timestamp;
Sid = sid;
Device = device;
}
/// <summary>
/// Gets or sets log timestamp, example: '2017-03-13T18:05:42Z'.
///
/// </summary>
[JsonProperty(PropertyName = "timestamp")]
public System.DateTime? Timestamp { get; set; }
/// <summary>
/// Gets or sets when tracking an analytics session, logs can be part
/// of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
///
/// </summary>
[JsonProperty(PropertyName = "sid")]
public System.Guid? Sid { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "device")]
public Device Device { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Device == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Device");
}
if (Device != null)
{
Device.Validate();
}
}
}
}

Просмотреть файл

@ -0,0 +1,64 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public partial class LogContainer
{
/// <summary>
/// Initializes a new instance of the LogContainer class.
/// </summary>
public LogContainer() { }
/// <summary>
/// Initializes a new instance of the LogContainer class.
/// </summary>
/// <param name="logs">The list of logs</param>
public LogContainer(IList<Log> logs)
{
Logs = logs;
}
/// <summary>
/// Gets or sets the list of logs
/// </summary>
[JsonProperty(PropertyName = "logs")]
public IList<Log> Logs { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Logs == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Logs");
}
if (Logs != null)
{
if (Logs.Count < 1)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinItems, "Logs", 1);
}
foreach (var element in Logs)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,60 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
public partial class LogWithProperties : Log
{
/// <summary>
/// Initializes a new instance of the LogWithProperties class.
/// </summary>
public LogWithProperties() { }
/// <summary>
/// Initializes a new instance of the LogWithProperties class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public LogWithProperties(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid)
{
Properties = properties;
}
/// <summary>
/// Gets or sets additional key/value pair parameters.
///
/// </summary>
[JsonProperty(PropertyName = "properties")]
public IDictionary<string, string> Properties { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,115 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Error log for managed platforms (such as Android Dalvik/ART).
/// </summary>
[JsonObject("managedError")]
public partial class ManagedErrorLog : AbstractErrorLog
{
/// <summary>
/// Initializes a new instance of the ManagedErrorLog class.
/// </summary>
public ManagedErrorLog() { }
/// <summary>
/// Initializes a new instance of the ManagedErrorLog class.
/// </summary>
/// <param name="id">Error identifier.</param>
/// <param name="processId">Process identifier.</param>
/// <param name="processName">Process name.</param>
/// <param name="fatal">If true, this error report is an application
/// crash.
/// Corresponds to the number of milliseconds elapsed between the time
/// the error occurred and the app was launched.</param>
/// <param name="exception">Exception associated to the error.</param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="parentProcessId">Parent's process identifier.</param>
/// <param name="parentProcessName">Parent's process name.</param>
/// <param name="errorThreadId">Error thread identifier.</param>
/// <param name="errorThreadName">Error thread name.</param>
/// <param name="appLaunchTimestamp">Timestamp when the app was
/// launched, example: '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="architecture">CPU architecture.</param>
/// <param name="buildId">Unique ID for a Xamarin build or another
/// similar technology.</param>
/// <param name="threads">Thread stack frames associated to the
/// error.</param>
public ManagedErrorLog(Device device, System.Guid id, int processId, string processName, bool fatal, Exception exception, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), int? parentProcessId = default(int?), string parentProcessName = default(string), long? errorThreadId = default(long?), string errorThreadName = default(string), System.DateTime? appLaunchTimestamp = default(System.DateTime?), string architecture = default(string), string buildId = default(string), IList<Thread> threads = default(IList<Thread>))
: base(device, id, processId, processName, fatal, timestamp, sid, parentProcessId, parentProcessName, errorThreadId, errorThreadName, appLaunchTimestamp, architecture)
{
BuildId = buildId;
Exception = exception;
Threads = threads;
}
/// <summary>
/// Gets or sets unique ID for a Xamarin build or another similar
/// technology.
/// </summary>
[JsonProperty(PropertyName = "buildId")]
public string BuildId { get; set; }
/// <summary>
/// Gets or sets exception associated to the error.
/// </summary>
[JsonProperty(PropertyName = "exception")]
public Exception Exception { get; set; }
/// <summary>
/// Gets or sets thread stack frames associated to the error.
/// </summary>
[JsonProperty(PropertyName = "threads")]
public IList<Thread> Threads { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Exception == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Exception");
}
if (Exception != null)
{
Exception.Validate();
}
if (Threads != null)
{
foreach (var element in Threads)
{
if (element != null)
{
element.Validate();
}
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,49 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Number property.
/// </summary>
[JsonObject("number")]
public partial class NumberProperty : CustomProperty
{
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
public NumberProperty() { }
/// <summary>
/// Initializes a new instance of the NumberProperty class.
/// </summary>
/// <param name="value">Number property value.</param>
public NumberProperty(string name, double value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets number property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public double Value { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,71 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Page view log (as in screens or activities).
/// </summary>
[JsonObject("page")]
public partial class PageLog : LogWithProperties
{
/// <summary>
/// Initializes a new instance of the PageLog class.
/// </summary>
public PageLog() { }
/// <summary>
/// Initializes a new instance of the PageLog class.
/// </summary>
/// <param name="name">Name of the page.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="properties">Additional key/value pair parameters.
/// </param>
public PageLog(Device device, string name, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IDictionary<string, string> properties = default(IDictionary<string, string>))
: base(device, timestamp, sid, properties)
{
Name = name;
}
/// <summary>
/// Gets or sets name of the page.
///
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Name == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Name");
}
}
}
}

Просмотреть файл

@ -0,0 +1,67 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Push installation Information.
/// </summary>
[JsonObject("pushInstallation")]
public partial class PushInstallationLog : Log
{
/// <summary>
/// Initializes a new instance of the PushInstallationLog class.
/// </summary>
public PushInstallationLog() { }
/// <summary>
/// Initializes a new instance of the PushInstallationLog class.
/// </summary>
/// <param name="pushToken">The PNS handle for this installation.
/// </param>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
public PushInstallationLog(Device device, string pushToken, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?))
: base(device, timestamp, sid)
{
PushToken = pushToken;
}
/// <summary>
/// Gets or sets the PNS handle for this installation.
///
/// </summary>
[JsonProperty(PropertyName = "pushToken")]
public string PushToken { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (PushToken == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "PushToken");
}
}
}
}

Просмотреть файл

@ -0,0 +1,87 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Stack frame definition for any platform.
/// </summary>
public partial class StackFrame
{
/// <summary>
/// Initializes a new instance of the StackFrame class.
/// </summary>
public StackFrame() { }
/// <summary>
/// Initializes a new instance of the StackFrame class.
/// </summary>
/// <param name="address">Frame address.</param>
/// <param name="code">Symbolized code line</param>
/// <param name="className">The fully qualified name of the Class
/// containing the execution point represented by this stack trace
/// element.</param>
/// <param name="methodName">The name of the method containing the
/// execution point represented by this stack trace element.</param>
/// <param name="lineNumber">The line number of the source line
/// containing the execution point represented by this stack trace
/// element.</param>
/// <param name="fileName">The name of the file containing the
/// execution point represented by this stack trace element.</param>
public StackFrame(string address = default(string), string code = default(string), string className = default(string), string methodName = default(string), int? lineNumber = default(int?), string fileName = default(string))
{
Address = address;
Code = code;
ClassName = className;
MethodName = methodName;
LineNumber = lineNumber;
FileName = fileName;
}
/// <summary>
/// Gets or sets frame address.
/// </summary>
[JsonProperty(PropertyName = "address")]
public string Address { get; set; }
/// <summary>
/// Gets or sets symbolized code line
/// </summary>
[JsonProperty(PropertyName = "code")]
public string Code { get; set; }
/// <summary>
/// Gets or sets the fully qualified name of the Class containing the
/// execution point represented by this stack trace element.
/// </summary>
[JsonProperty(PropertyName = "className")]
public string ClassName { get; set; }
/// <summary>
/// Gets or sets the name of the method containing the execution point
/// represented by this stack trace element.
/// </summary>
[JsonProperty(PropertyName = "methodName")]
public string MethodName { get; set; }
/// <summary>
/// Gets or sets the line number of the source line containing the
/// execution point represented by this stack trace element.
/// </summary>
[JsonProperty(PropertyName = "lineNumber")]
public int? LineNumber { get; set; }
/// <summary>
/// Gets or sets the name of the file containing the execution point
/// represented by this stack trace element.
/// </summary>
[JsonProperty(PropertyName = "fileName")]
public string FileName { get; set; }
}
}

Просмотреть файл

@ -0,0 +1,72 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Describe a MobileCenter.Start API call from the SDK.
/// </summary>
[JsonObject("startService")]
public partial class StartServiceLog : Log
{
/// <summary>
/// Initializes a new instance of the StartServiceLog class.
/// </summary>
public StartServiceLog() { }
/// <summary>
/// Initializes a new instance of the StartServiceLog class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
/// <param name="services">The list of services of the MobileCenter
/// Start API call.</param>
public StartServiceLog(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?), IList<string> services = default(IList<string>))
: base(device, timestamp, sid)
{
Services = services;
}
/// <summary>
/// Gets or sets the list of services of the MobileCenter Start API
/// call.
/// </summary>
[JsonProperty(PropertyName = "services")]
public IList<string> Services { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Services != null)
{
if (Services.Count < 1)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MinItems, "Services", 1);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,53 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// Required explicit begin session log (a marker event for analytics
/// service).
/// </summary>
[JsonObject("startSession")]
public partial class StartSessionLog : Log
{
/// <summary>
/// Initializes a new instance of the StartSessionLog class.
/// </summary>
public StartSessionLog() { }
/// <summary>
/// Initializes a new instance of the StartSessionLog class.
/// </summary>
/// <param name="timestamp">Log timestamp, example:
/// '2017-03-13T18:05:42Z'.
/// </param>
/// <param name="sid">When tracking an analytics session, logs can be
/// part of the session by specifying this identifier.
/// This attribute is optional, a missing value means the session
/// tracking is disabled (like when using only error reporting
/// feature).
/// Concrete types like StartSessionLog or PageLog are always part of a
/// session and always include this identifier.
/// </param>
public StartSessionLog(Device device, System.DateTime? timestamp = default(System.DateTime?), System.Guid? sid = default(System.Guid?))
: base(device, timestamp, sid)
{
}
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
}
}
}

Просмотреть файл

@ -0,0 +1,61 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Linq;
/// <summary>
/// String property.
/// </summary>
[JsonObject("string")]
public partial class StringProperty : CustomProperty
{
/// <summary>
/// Initializes a new instance of the StringProperty class.
/// </summary>
public StringProperty() { }
/// <summary>
/// Initializes a new instance of the StringProperty class.
/// </summary>
/// <param name="value">String property value.</param>
public StringProperty(string name, string value)
: base(name)
{
Value = value;
}
/// <summary>
/// Gets or sets string property value.
/// </summary>
[JsonProperty(PropertyName = "value")]
public string Value { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public override void Validate()
{
base.Validate();
if (Value == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Value");
}
if (Value != null)
{
if (Value.Length > 128)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.MaxLength, "Value", 128);
}
}
}
}
}

Просмотреть файл

@ -0,0 +1,79 @@
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace Microsoft.AppCenter.Ingestion.Models
{
using Microsoft.AppCenter;
using Microsoft.AppCenter.Ingestion;
using Microsoft.Rest;
using Newtonsoft.Json;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
/// <summary>
/// Thread definition for any platform.
/// </summary>
public partial class Thread
{
/// <summary>
/// Initializes a new instance of the Thread class.
/// </summary>
public Thread() { }
/// <summary>
/// Initializes a new instance of the Thread class.
/// </summary>
/// <param name="id">Thread identifier.</param>
/// <param name="frames">Stack frames.</param>
/// <param name="name">Thread name.</param>
public Thread(int id, IList<StackFrame> frames, string name = default(string), Exception exception = default(Exception))
{
Id = id;
Name = name;
Frames = frames;
Exception = exception;
}
/// <summary>
/// Gets or sets thread identifier.
/// </summary>
[JsonProperty(PropertyName = "id")]
public int Id { get; set; }
/// <summary>
/// Gets or sets thread name.
/// </summary>
[JsonProperty(PropertyName = "name")]
public string Name { get; set; }
/// <summary>
/// Gets or sets stack frames.
/// </summary>
[JsonProperty(PropertyName = "frames")]
public IList<StackFrame> Frames { get; set; }
/// <summary>
/// </summary>
[JsonProperty(PropertyName = "exception")]
public Exception Exception { get; set; }
/// <summary>
/// Validate the object.
/// </summary>
/// <exception cref="Microsoft.Rest.ValidationException">
/// Thrown if validation fails
/// </exception>
public virtual void Validate()
{
if (Frames == null)
{
throw new Microsoft.Rest.ValidationException(Microsoft.Rest.ValidationRules.CannotBeNull, "Frames");
}
if (Exception != null)
{
Exception.Validate();
}
}
}
}

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -1,112 +0,0 @@
swagger: "2.0"
info:
version: "1.0.0-preview20160930"
title: Avalanche.Crash
description: Microsoft Avalanche Crash REST API.
host: localhost:1337
basePath: /v0.1
schemes:
- https
consumes:
- application/json
produces:
- application/json
paths:
/crashes:
post:
description: API for notifying that a crash has been uploaded to storage for processing
operationId: notifyCrash
consumes:
- application/json
parameters:
- in: body
name: body
description: Array of uploaded crash location notifications
required: true
schema:
type: array
items:
$ref: "#/definitions/crash_ingestion_message"
responses:
"200":
description: Success
"400":
description: Error
schema:
$ref: "#/definitions/error_response"
security:
- Bearer: []
/status:
get:
description: Returns the service status to the caller
operationId: status
responses:
"200":
description: Success
schema:
$ref: "#/definitions/status_response"
"400":
description: Error
schema:
$ref: "#/definitions/error_response"
definitions:
crash_ingestion_message:
required:
- app_id
- app_start_timestamp
- blob_url
- id
- ingest_timestamp
- install_id
- timestamp
properties:
app_id:
description: The Identity of the Application
type: string
format: uuid
blob_url:
description: The full URI including SASToken to blob storage
type: string
id:
description: unique identifier for crash so can track problems in system
type: string
format: uuid
timestamp:
description: timestamp for error log
type: string
format: date-time
ingest_timestamp:
description: timestamp for error log reaching backend
type: string
format: date-time
install_id:
description: device installation id
type: string
format: uuid
app_start_timestamp:
description: app start timestamp
type: string
format: date-time
status_response:
required:
- status
properties:
status:
type: string
error_response:
required:
- message
properties:
message:
type: string
securityDefinitions:
Bearer:
type: apiKey
name: Authorization
in: header

Просмотреть файл

@ -1,93 +0,0 @@
swagger: '2.0'
info:
title: Sonoma.Devices
description: Microsoft Sonoma Device Information REST API.
version: '1.0.0-preview20161024'
host: devices.prod.avalanch.es
schemes:
- https
consumes:
- application/json
produces:
- application/json
basePath: /v0.1
paths:
'/devices/model_mappings_csv':
get:
operationId: Devices_ModelMappingCsv
x-client-operation: Devices_ModelMappingCsv
description: Gets the device model mappings in CSV format
produces:
- file/csv
responses:
'200':
description: The device model mappings in CSV format
schema:
type: file
default:
description: Error code with reason
schema:
$ref: '#/definitions/Error'
'/devices/model_mappings_json':
get:
operationId: Devices_ModelMappingJson
x-client-operation: Devices_ModelMappingJson
description: Gets the device model mappings in JSON format
responses:
'200':
description: The device model mappings in JSON format
schema:
type: object
additionalProperties:
$ref: '#/definitions/DeviceMapping'
default:
description: Error code with reason
schema:
$ref: '#/definitions/Error'
'/devices/model_mapping':
get:
operationId: Devices_ModelMapping
x-client-operation: Devices_ModelMapping
description: Gets the device model mapping
responses:
'200':
description: The device model mapping
schema:
$ref: '#/definitions/DeviceMapping'
default:
description: Error code with reason
schema:
$ref: '#/definitions/Error'
definitions:
DeviceMapping:
description: Device mapping
type: object
properties:
os:
description: Operating system
type: string
enum: [ 'Unknown', 'iOS', 'Android' ]
name:
description: Device name
type: string
man:
description: Manufacturer name
type: string
Error:
description: Error
type: object
properties:
error:
type: object
properties:
code:
description: The status code return by the API. It can be 400 or 403 or 500.
type: integer
enum: [
400,
403,
500
]
message:
description: The reason for the request failed
type: string

Просмотреть файл

@ -3,6 +3,7 @@ info:
title: Avalanche.Ingestion
description: Microsoft Avalanche Ingestion REST API.
version: '1.0.0-preview20160914'
"x-private": true
host: avalanche.com
schemes:
- https
@ -47,7 +48,7 @@ paths:
parameters:
ApiVersionParameter:
name: api_version
name: api-version
in: query
required: true
type: string
@ -71,10 +72,12 @@ definitions:
properties:
type:
type: string
toffset:
type: integer
format: int64
description: Corresponds to the number of milliseconds elapsed between the time the request is sent and the time the log is emitted.
timestamp:
type: string
format: date-time
minimum: '1980-01-01T01:00:00Z'
description: >
Log timestamp, example: '2017-03-13T18:05:42Z'.
sid:
type: string
format: uuid
@ -88,7 +91,6 @@ definitions:
$ref: '#/definitions/Device'
required:
- type
- toffset
- device
LogWithProperties:
@ -107,20 +109,20 @@ definitions:
type: object
description: Device characteristics.
properties:
sdk_name:
sdkName:
type: string
description: >
Name of the SDK. Consists of the name of the SDK and the platform, e.g. "mobilecenter.ios", "hockeysdk.android".
sdk_version:
sdkVersion:
type: string
description: >
Version of the SDK in semver format, e.g. "1.2.0" or "0.12.3-alpha.1".
wrapper_sdk_version:
wrapperSdkVersion:
type: string
description: >
Version of the wrapper SDK in semver format. When the SDK is embedding another base SDK (for example Xamarin.Android wraps Android),
the Xamarin specific version is populated into this field while sdkVersion refers to the original Android SDK.
wrapper_sdk_name:
wrapperSdkName:
type: string
description: >
Name of the wrapper SDK. Consists of the name of the SDK and the wrapper platform, e.g. "mobilecenter.xamarin", "hockeysdk.cordova".
@ -128,88 +130,195 @@ definitions:
type: string
description: >
Device model (example: iPad2,3).
oem_name:
oemName:
type: string
description: >
Device manufacturer (example: HTC).
os_name:
osName:
type: string
description: >
OS name (example: iOS).
The following OS names are standardized (non-exclusive): Android, iOS, macOS, tvOS, Windows.
os_version:
osVersion:
type: string
description: >
OS version (example: 9.3.0).
os_build:
osBuild:
type: string
description: >
OS build code (example: LMY47X).
os_api_level:
osApiLevel:
type: integer
description: >
API level when applicable like in Android (example: 15).
locale:
type: string
description: >
Language code (example: en_US).
time_zone_offset:
Language code (example: en-US).
timeZoneOffset:
type: integer
minimum: -840
maximum: 840
description: >
The offset in minutes from UTC for the device time zone, including daylight savings time.
screen_size:
screenSize:
type: string
description: >
Screen size of the device in pixels (example: 640x480).
app_version:
appVersion:
type: string
description: >
Application version name, e.g. 1.1.0
carrier_name:
carrierName:
type: string
description: >
Carrier name (for mobile devices).
carrier_country:
carrierCountry:
type: string
description: >
Carrier country code (for mobile devices).
app_build:
appBuild:
type: string
description: >
The app's build number, e.g. 42.
app_namespace:
appNamespace:
type: string
description: >
The bundle identifier, package identifier, or namespace, depending on what the individual plattforms use, .e.g com.microsoft.example.
live_update_release_label:
liveUpdateReleaseLabel:
type: string
description: >
Label that is used to identify application code 'version' released via Live Update beacon running on device
live_update_deployment_key:
liveUpdateDeploymentKey:
type: string
description: >
Identifier of environment that current application release belongs to, deployment key then maps to environment like Production, Staging.
live_update_package_hash:
liveUpdatePackageHash:
type: string
description: >
Hash of all files (ReactNative or Cordova) deployed to device via LiveUpdate beacon. Helps identify the Release version on device or need to download updates in future
Hash of all files (ReactNative or Cordova) deployed to device via LiveUpdate beacon. Helps identify the Release version on device or need to download updates in future.
wrapperRuntimeVersion:
type: string
description: >
Version of the wrapper technology framework (Xamarin runtime version or ReactNative or Cordova etc...). See wrappersdkname to see if this version refers to Xamarin or ReactNative or other.
required:
- sdk_name
- sdk_version
- model
- oem_name
- os_name
- os_version
- sdkName
- sdkVersion
- osName
- osVersion
- locale
- time_zone_offset
- screen_size
- app_version
- app_build
- timeZoneOffset
- appVersion
- appBuild
StartServiceLog:
type: object
description: Describe a MobileCenter.Start API call from the SDK.
x-ms-discriminator-value: startService
allOf:
- $ref: '#/definitions/Log'
properties:
services:
type: array
description: The list of services of the MobileCenter Start API call.
minItems: 1
items:
type : string
CustomPropertyLog:
type: object
description: Set or remove custom properties.
x-ms-discriminator-value: customProperties
allOf:
- $ref: '#/definitions/Log'
properties:
properties:
type: array
description: Custom property changes.
minItems: 1
maxItems: 60
items:
$ref: '#/definitions/CustomProperty'
CustomProperty:
type: object
discriminator: type
properties:
type:
type: string
name:
type: string
maxLength: 128
pattern: '^[a-zA-Z][a-zA-Z0-9\-_]*$'
required:
- type
- name
StringProperty:
type: object
description: String property.
x-ms-discriminator-value: string
allOf:
- $ref: '#/definitions/CustomProperty'
properties:
value:
type: string
maxLength: 128
description: String property value.
required:
- value
NumberProperty:
type: object
description: Number property.
x-ms-discriminator-value: number
allOf:
- $ref: '#/definitions/CustomProperty'
properties:
value:
type: number
description: Number property value.
required:
- value
BooleanProperty:
type: object
description: Boolean property.
x-ms-discriminator-value: boolean
allOf:
- $ref: '#/definitions/CustomProperty'
properties:
value:
type: boolean
description: Boolean property value.
required:
- value
DateTimeProperty:
type: object
description: Date and time property.
x-ms-discriminator-value: dateTime
allOf:
- $ref: '#/definitions/CustomProperty'
properties:
value:
type: string
format: date-time
description: Date time property value.
required:
- value
ClearProperty:
type: object
description: Clear an existing property.
x-ms-discriminator-value: clear
allOf:
- $ref: '#/definitions/CustomProperty'
StartSessionLog:
type: object
description: Required explicit begin session log (a marker event for analytics service).
x-ms-discriminator-value: start_session
x-ms-discriminator-value: startSession
allOf:
- $ref: '#/definitions/Log'
@ -241,6 +350,7 @@ definitions:
Unique identifier for this event.
name:
type: string
maxLength: 256
description: >
Name of the event.
required:
@ -250,37 +360,16 @@ definitions:
PushInstallationLog:
type: object
description: Push installation Information.
x-ms-discriminator-value: push_installation
x-ms-discriminator-value: pushInstallation
allOf:
- $ref: '#/definitions/Log'
properties:
installation_id:
type: string
description: >
Globally unique identifier string.
push_channel:
pushToken:
type: string
description: >
The PNS handle for this installation.
platform:
type: string
enum: ["apns","gcm"]
description: >
Device platform.
tags:
type: array
description: The list of tags.
minItems: 0
items:
type : string
is_patch:
type: boolean
description: >
If true, tags will be added to existing tags, else all tags will be overwritten.
required:
- installation_id
- push_channel
- platform
- pushToken
AbstractErrorLog:
type: object
@ -292,44 +381,44 @@ definitions:
type: string
format: uuid
description: Error identifier.
process_id:
processId:
type: integer
description: Process identifier.
process_name:
processName:
type: string
description: Process name.
parent_process_id:
parentProcessId:
type: integer
description: Parent's process identifier.
parent_process_name:
parentProcessName:
type: string
description: Parent's process name.
error_thread_id:
errorThreadId:
type: integer
format: int64
description: Error thread identifier.
error_thread_name:
errorThreadName:
type: string
description: Error thread name.
fatal:
type: boolean
description: If true, this error report is an application crash.
app_launch_toffset:
type: integer
format: int64
description: Corresponds to the number of milliseconds elapsed between the time the error occurred and the app was launched.
error_attachment:
description: Error attachment.
$ref: '#/definitions/ErrorAttachment'
Corresponds to the number of milliseconds elapsed between the time the error occurred and the app was launched.
appLaunchTimestamp:
type: string
format: date-time
minimum: '1980-01-01T01:00:00Z'
description: >
Timestamp when the app was launched, example: '2017-03-13T18:05:42Z'.
architecture:
type: string
description: CPU architecture.
required:
- id
- process_id
- process_name
- processId
- processName
- fatal
- app_launch_toffset
Threads:
type: array
@ -343,66 +432,42 @@ definitions:
items:
$ref: '#/definitions/Binary'
ErrorAttachment:
type: object
description: Attachment for error log.
properties:
text_attachment:
type: string
description: Plain text attachment.
binary_attachment:
description: Binary attachment.
$ref: '#/definitions/ErrorBinaryAttachment'
ErrorBinaryAttachment:
type: object
description: Binary attachment for error log.
properties:
content_type:
type: string
description: Content type for binary data.
file_name:
type: string
description: File name for binary data.
data:
type: string
description: Binary data.
format: byte
required:
- content_type
- data
AppleErrorLog:
type: object
description: Error log for Apple platforms.
x-ms-discriminator-value: apple_error
x-ms-discriminator-value: appleError
allOf:
- $ref: '#/definitions/AbstractErrorLog'
properties:
primary_architecture_id:
primaryArchitectureId:
type: integer
format: int64
description: CPU primary architecture.
architecture_variant_id:
architectureVariantId:
type: integer
format: int64
description: CPU architecture variant.
application_path:
applicationPath:
type: string
description: Path to the application.
os_exception_type:
osExceptionType:
type: string
description: OS exception type.
os_exception_code:
osExceptionCode:
type: string
description: OS exception code.
os_exception_address:
osExceptionAddress:
type: string
description: OS exception address.
exception_type:
exceptionType:
type: string
description: Exception type.
exception_reason:
exceptionReason:
type: string
description: Exception reason.
selectorRegisterValue:
type: string
description: Content of register that might contain last method call.
threads:
description: Thread stack frames associated to the error.
$ref: '#/definitions/Threads'
@ -421,11 +486,11 @@ definitions:
This is used for example to send a .NET exception from the Xamarin SDK.
$ref: '#/definitions/Exception'
required:
- primary_architecture_id
- application_path
- os_exception_type
- os_exception_code
- os_exception_address
- primaryArchitectureId
- applicationPath
- osExceptionType
- osExceptionCode
- osExceptionAddress
Thread:
description: Thread definition for any platform.
@ -456,26 +521,25 @@ definitions:
message:
type: string
description: Exception reason.
stack_trace:
stackTrace:
type: string
description: Raw stack trace. Sent when the frames property is either missing or unreliable.
frames:
type: array
description: Stack frames.
description: Stack frames. Optional.
items:
$ref: '#/definitions/StackFrame'
inner_exceptions:
innerExceptions:
type: array
description: Inner exceptions of this exception.
items:
$ref: '#/definitions/Exception'
wrapper_sdk_name:
wrapperSdkName:
type: string
description: >
Name of the wrapper SDK that emitted this exeption. Consists of the name of the SDK and the wrapper platform, e.g. "mobilecenter.xamarin", "hockeysdk.cordova".
required:
- type
- frames
StackFrame:
description: Stack frame definition for any platform.
@ -486,16 +550,16 @@ definitions:
code:
type: string
description: Symbolized code line
class_name:
className:
type: string
description: The fully qualified name of the Class containing the execution point represented by this stack trace element.
method_name:
methodName:
type: string
description: The name of the method containing the execution point represented by this stack trace element.
line_number:
lineNumber:
type: integer
description: The line number of the source line containing the execution point represented by this stack trace element.
file_name:
fileName:
type: string
description: The name of the file containing the execution point represented by this stack trace element.
@ -505,9 +569,9 @@ definitions:
id:
type: string
format: uuid
start_address:
startAddress:
type: string
end_address:
endAddress:
type: string
name:
type: string
@ -515,27 +579,29 @@ definitions:
type: string
architecture:
type: string
primary_architecture_id:
primaryArchitectureId:
type: integer
format: int64
description: CPU primary architecture.
architecture_variant_id:
architectureVariantId:
type: integer
format: int64
description: CPU architecture variant.
required:
- id
- start_address
- end_address
- startAddress
- endAddress
- name
- path
ManagedErrorLog:
type: object
description: Error log for managed platforms (such as Android Dalvik/ART).
x-ms-discriminator-value: managed_error
x-ms-discriminator-value: managedError
allOf:
- $ref: '#/definitions/AbstractErrorLog'
properties:
build_id:
buildId:
type: string
description: Unique ID for a Xamarin build or another similar technology.
exception:
@ -546,3 +612,52 @@ definitions:
$ref: '#/definitions/Threads'
required:
- exception
HandledErrorLog:
type: object
description: Handled Error log for managed platforms (such as Xamarin, Unity, Android Dalvik/ART)
x-ms-discriminator-value: handledError
allOf:
- $ref: '#/definitions/Log'
properties:
id:
type: string
format: uuid
description: >
Unique identifier for this Error.
exception:
description: Exception associated to the error.
$ref: '#/definitions/Exception'
required:
- exception
ErrorAttachmentLog:
type: object
description: Error attachment log.
x-ms-discriminator-value: errorAttachment
allOf:
- $ref: '#/definitions/Log'
properties:
id:
type: string
format: uuid
description: Error attachment identifier.
errorId:
type: string
format: uuid
description: Error log identifier to attach this log to.
contentType:
type: string
description: Content type (text/plain for text).
fileName:
type: string
description: File name.
data:
type: string
format: byte
description: Data encoded as base 64.
required:
- id
- errorId
- contentType
- data