/// <summary> /// Initializes client properties. /// </summary> private void Initialize() { HealthApi = new HealthApi(this); BaseUri = new System.Uri("http://localhost"); SerializationSettings = new 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 ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; DeserializationSettings = new JsonSerializerSettings { DateFormatHandling = Newtonsoft.Json.DateFormatHandling.IsoDateFormat, DateTimeZoneHandling = Newtonsoft.Json.DateTimeZoneHandling.Utc, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore, ReferenceLoopHandling = Newtonsoft.Json.ReferenceLoopHandling.Serialize, ContractResolver = new ReadOnlyJsonContractResolver(), Converters = new List <JsonConverter> { new Iso8601TimeSpanConverter() } }; CustomInitialize(); }
/// <summary> /// Get service health status. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> /// <param name='cancellationToken'> /// The cancellation token. /// </param> public static async Task GetHealthStatusAsync(this IHealthApi operations, CancellationToken cancellationToken = default(CancellationToken)) { (await operations.GetHealthStatusWithHttpMessagesAsync(null, cancellationToken).ConfigureAwait(false)).Dispose(); }
/// <summary> /// Get service health status. /// </summary> /// <param name='operations'> /// The operations group for this extension method. /// </param> public static void GetHealthStatus(this IHealthApi operations) { operations.GetHealthStatusAsync().GetAwaiter().GetResult(); }
public DesignAutomationClient(ForgeService service = null, IOptions <Configuration> configuration = null, IActivitiesApi activities = null, IAppBundlesApi appBundles = null, IEnginesApi engines = null, IForgeAppsApi forgeApps = null, IHealthApi health = null, IServiceLimitsApi serviceLimits = null, ISharesApi shares = null, IWorkItemsApi workItems = null) { this.Configuration = configuration?.Value ?? new Configuration(); this.Service = service ?? ForgeService.CreateDefault(); // set BaseAddress from configuration this.Service.Client.BaseAddress = Configuration.BaseAddress; this.ActivitiesApi = activities ?? new ActivitiesApi(service, configuration); this.AppBundlesApi = appBundles ?? new AppBundlesApi(service, configuration); this.EnginesApi = engines ?? new EnginesApi(service, configuration); this.ForgeAppsApi = forgeApps ?? new ForgeAppsApi(service, configuration); this.HealthApi = health ?? new HealthApi(service, configuration); this.ServiceLimitsApi = serviceLimits ?? new ServiceLimitsApi(service, configuration); this.SharesApi = shares ?? new SharesApi(service, configuration); this.WorkItemsApi = workItems ?? new WorkItemsApi(service, configuration); }
public DesignAutomationClient(ForgeService service = null, IOptions <Configuration> configuration = null, IActivitiesApi activitiesApi = null, IAppBundlesApi appBundlesApi = null, IEnginesApi enginesApi = null, IForgeAppsApi forgeAppsApi = null, IHealthApi healthApi = null, ISharesApi sharesApi = null, IWorkItemsApi workItemsApi = null) { this.Service = service ?? ForgeService.CreateDefault(); // set BaseAddress from configuration or default this.Service.Client.BaseAddress = configuration?.Value.BaseAddress ?? new Configuration().BaseAddress; if (this.ActivitiesApi == null) { this.ActivitiesApi = new ActivitiesApi(service, configuration); } else { this.ActivitiesApi = activitiesApi; } if (this.AppBundlesApi == null) { this.AppBundlesApi = new AppBundlesApi(service, configuration); } else { this.AppBundlesApi = appBundlesApi; } if (this.EnginesApi == null) { this.EnginesApi = new EnginesApi(service, configuration); } else { this.EnginesApi = enginesApi; } if (this.ForgeAppsApi == null) { this.ForgeAppsApi = new ForgeAppsApi(service, configuration); } else { this.ForgeAppsApi = forgeAppsApi; } if (this.HealthApi == null) { this.HealthApi = new HealthApi(service, configuration); } else { this.HealthApi = healthApi; } if (this.SharesApi == null) { this.SharesApi = new SharesApi(service, configuration); } else { this.SharesApi = sharesApi; } if (this.WorkItemsApi == null) { this.WorkItemsApi = new WorkItemsApi(service, configuration); } else { this.WorkItemsApi = workItemsApi; } }