/// <summary> /// Gets information about the HealthVault service corresponding to the specified /// categories. /// </summary> /// /// <param name="connection">The connection to use to perform the operation.</param> /// /// <param name="responseSections"> /// A bitmask of one or more <see cref="ServiceInfoSections"/> which specify the /// categories of information to be populated in the <see cref="ServiceInfo"/>. /// </param> /// /// <remarks> /// Gets the latest information about the HealthVault service. Depending on the specified /// <paramref name="responseSections"/>, this will include some or all of:<br/> /// - The version of the service.<br/> /// - The SDK assembly URLs.<br/> /// - The SDK assembly versions.<br/> /// - The SDK documentation URL.<br/> /// - The URL to the HealthVault Shell.<br/> /// - The schema definition for the HealthVault method's request and /// response.<br/> /// - The common schema definitions for types that the HealthVault methods /// use.<br/> /// - Information about all available HealthVault instances.<br/> /// /// Retrieving only the sections you need will give a faster response time than /// downloading the full response. /// </remarks> /// /// <returns> /// A <see cref="ServiceInfo"/> instance that contains some or all of the service version, /// SDK assemblies versions and URLs, method information, and so on, depending on which /// information categories were specified. /// </returns> /// /// <exception cref="ArgumentNullException"> /// <paramref name="connection"/> is <b>null</b>. /// </exception> /// /// <exception cref="HealthServiceException"> /// The HealthVault service returned an error. /// </exception> /// /// <exception cref="UriFormatException"> /// One or more URL strings returned by HealthVault is invalid. /// </exception> /// public virtual async Task <ServiceInfo> GetServiceDefinitionAsync( IHealthVaultConnection connection, ServiceInfoSections responseSections) { Validator.ThrowIfArgumentNull(connection, nameof(connection), Resources.ConnectionNull); string requestParams = CreateServiceDefinitionRequestParameters(responseSections, null); return(await GetServiceDefinitionAsync(connection, requestParams).ConfigureAwait(false)); }
private static string CreateServiceDefinitionRequestParameters( ServiceInfoSections responseSections, Instant?lastUpdatedTime) { StringBuilder requestBuilder = new StringBuilder(); using (XmlWriter writer = XmlWriter.Create(requestBuilder, SDKHelper.XmlUnicodeWriterSettings)) { if (lastUpdatedTime != null) { writer.WriteElementString( "updated-date", SDKHelper.XmlFromInstant(lastUpdatedTime.Value)); } writer.WriteStartElement("response-sections"); if ((responseSections & ServiceInfoSections.Platform) == ServiceInfoSections.Platform) { writer.WriteElementString("section", "platform"); } if ((responseSections & ServiceInfoSections.Shell) == ServiceInfoSections.Shell) { writer.WriteElementString("section", "shell"); } if ((responseSections & ServiceInfoSections.Topology) == ServiceInfoSections.Topology) { writer.WriteElementString("section", "topology"); } if ((responseSections & ServiceInfoSections.XmlOverHttpMethods) == ServiceInfoSections.XmlOverHttpMethods) { writer.WriteElementString("section", "xml-over-http-methods"); } if ((responseSections & ServiceInfoSections.MeaningfulUse) == ServiceInfoSections.MeaningfulUse) { writer.WriteElementString("section", "meaningful-use"); } writer.WriteEndElement(); writer.Flush(); } return(requestBuilder.ToString()); }
public Task <ServiceInfo> GetServiceDefinitionAsync(ServiceInfoSections responseSections, Instant lastUpdatedTime) { return(HealthVaultPlatformInformation.Current.GetServiceDefinitionAsync(_connection, responseSections, lastUpdatedTime)); }
public Task <ServiceInfo> GetServiceDefinitionAsync(ServiceInfoSections responseSections) { return(HealthVaultPlatformInformation.Current.GetServiceDefinitionAsync(_connection, responseSections)); }