/// <summary>
        /// Initializes a new instance of the <see cref="AuthenticationApiClient" /> class.
        /// </summary>
        /// <param name="baseUri">The base URI.</param>
        /// <param name="diagnostics">The diagnostics.</param>
        public AuthenticationApiClient(Uri baseUri, DiagnosticsHeader diagnostics)
        {
            this.baseUri = baseUri;

            // If no diagnostics header structure was specified, then revert to the default one
            if (diagnostics == null)
            {
                diagnostics = DiagnosticsHeader.Default;
            }

            apiConnection = new ApiConnection(null, baseUri.AbsoluteUri, diagnostics);
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="ManagementApiClient"/> class.
        /// </summary>
        /// <param name="token">The token.</param>
        /// <param name="baseUri">The base URI.</param>
        /// <param name="diagnostics">The diagnostics.</param>
        public ManagementApiClient(string token, Uri baseUri, DiagnosticsHeader diagnostics)
        {
            // If no diagnostics header structure was specified, then revert to the default one
            if (diagnostics == null)
            {
                diagnostics = DiagnosticsHeader.Default;
            }

            apiConnection = new ApiConnection(token, baseUri.AbsoluteUri, diagnostics);

            BlacklistedTokens = new BlacklistedTokensClient(apiConnection);
            Clients = new ClientsClient(apiConnection);
            Connections = new ConnectionsClient(apiConnection);
            DeviceCredentials = new DeviceCredentialsClient(apiConnection);
            EmailProvider = new EmailProviderClient(apiConnection);
            Jobs = new JobsClient(apiConnection);
            Rules = new RulesClient(apiConnection);
            Stats = new StatsClient(apiConnection);
            TenantSettings = new TentantSettingsClient(apiConnection);
            Tickets = new TicketsClient(apiConnection);
            Users = new UsersClient(apiConnection);

        }
 /// <summary>
 ///     Resets the <see cref="Default" /> and <see cref="Suppress" /> instances.
 /// </summary>
 public static void Reset()
 {
     _default = null;
     suppress = null;
 }
        private static DiagnosticsHeader CreateDefault()
        {
            var sdkAssembly = typeof (DiagnosticsHeader).GetTypeInfo().Assembly;
            var sdkAssemblyName = sdkAssembly.GetName();

            var header = new DiagnosticsHeader(sdkAssemblyName);

            // Extract dependencies from the Nuget packages.config
            using (var stream = sdkAssembly.GetManifestResourceStream(string.Format("{0}.packages.config", sdkAssemblyName.Name)))
            {
                XElement root = XElement.Load(stream);
                header.Dependencies = root.Elements("package")
                    .Select(e => new DiagnosticsComponent(e.Attribute("id").Value, e.Attribute("version").Value))
                    .ToList();
            }

            // Hard code PCL header for now
            header.Environments = new[]
            {
                new DiagnosticsComponent(".NET PCL", "Profile111")
            };

            return header;
        }
Exemple #5
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ApiConnection"/> class.
 /// </summary>
 /// <param name="token">The API token.</param>
 /// <param name="baseUrl">The base URL of the requests.</param>
 /// <param name="diagnostics">The diagnostics. header</param>
 public ApiConnection(string token, string baseUrl, DiagnosticsHeader diagnostics)
 {
     this.token       = token;
     this.diagnostics = diagnostics;
     this.baseUrl     = baseUrl;
 }
 /// <summary>
 ///     Resets the <see cref="Default" /> and <see cref="Suppress" /> instances.
 /// </summary>
 public static void Reset()
 {
     _default = null;
     suppress = null;
 }