/// <summary>
 /// Gets information about an open query.
 /// </summary>
 /// 
 /// <param name="connection">
 /// The <see cref="AuthenticatedConnection"/> instance to use for 
 /// getting information about the open query.
 /// </param>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public OpenQuery GetInfoFromOpenQuery(AuthenticatedConnection connection)
 {
     return GetInfoFromOpenQuery(connection, Id);
 }
 /// <summary>
 /// Gets information about an open query.
 /// </summary>
 /// 
 /// <param name="connection">
 /// The <see cref="AuthenticatedConnection"/> instance used to
 /// get information about the open query.
 /// </param>
 /// 
 /// <param name="queryId">
 /// The unique identifier of the open query for which the information 
 /// will be retrieved.
 /// </param>
 /// 
 /// <exception cref="ArgumentException">
 /// The <paramref name="queryId"/> parameter is empty.
 /// </exception>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public static OpenQuery GetInfoFromOpenQuery(
     AuthenticatedConnection connection,
     Guid queryId)
 {
     return HealthVaultPlatformOpenQuery.Current.GetInfoFromOpenQuery(connection, queryId);
 }
 /// <summary>
 /// Removes the saved open query from the server.
 /// </summary>
 /// 
 /// <param name="connection">
 /// The <see cref="AuthenticatedConnection"/> instance used to remove 
 /// the <see cref="OpenQuery"/>.
 /// </param>
 /// 
 /// <param name="queryId">
 /// The unique identifier of the open query that will be removed.
 /// </param>
 /// 
 /// <remarks>
 /// The person authenticated with the <paramref name="connection"/> 
 /// must have permission to remove the open query.
 /// </remarks>
 /// 
 /// <exception cref="ArgumentException">
 /// The <paramref name="queryId"/> parameter is empty.
 /// </exception>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public static void Remove(
     AuthenticatedConnection connection,
     Guid queryId)
 {
     HealthVaultPlatform.RemoveOpenQuery(connection, queryId);
 }
 /// <summary>
 /// Creates a new open query using the specified 
 /// <see cref="AuthenticatedConnection"/>, definition, expiration time,
 /// personal identification number (PIN), description, and XSL.
 /// </summary>
 /// 
 /// <param name="connection">
 /// An <see cref="AuthenticatedConnection"/> instance that creates the 
 /// new open query.
 /// </param>
 /// 
 /// <param name="searcher">
 /// A <see cref="HealthRecordSearcher"/> instance that defines the open query.
 /// </param>
 ///
 /// <param name="expires">
 /// The number of minutes the query will expire from the creation time.
 /// A value of Int32.MaxValue denotes that the query does not expire.
 /// </param>
 ///
 /// <param name="pinCode">
 /// The PIN that protects the query.  
 /// </param>
 ///
 /// <param name="note">
 /// The note describing the query.
 /// </param>
 /// 
 /// <param name="finalXsl">
 /// The XSL that transforms the results of the query when the 
 /// <see cref="OpenQuery"/> is invoked.
 /// </param>
 /// 
 /// <returns>
 /// An <see cref="OpenQuery"/> instance that represents the newly created query.
 /// </returns>
 /// 
 /// <remarks>
 /// The creation of an open query makes public the data returned by that 
 /// query. However, the query URL must be known to retrieve the data.
 /// </remarks>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> or <paramref name="searcher"/> 
 /// parameter is <b>null</b>.
 /// </exception>
 /// 
 /// 
 /// <exception cref="ArgumentException">
 /// The <paramref name="searcher"/> parameter contains no valid search
 /// filters or the <paramref name="pinCode"/> parameter is <b>null</b> 
 /// or empty.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public static OpenQuery NewQuery(
     AuthenticatedConnection connection,
     HealthRecordSearcher searcher,
     int expires,
     string pinCode,
     string note,
     string finalXsl)
 {
     return HealthVaultPlatform.NewOpenQuery(
         connection,
         searcher,
         expires,
         pinCode,
         note,
         finalXsl);
 }
        /// <summary>
        /// Creates a new open query using the specified 
        /// <see cref="AuthenticatedConnection"/>, definition, and personal
        /// identification number (PIN).
        /// </summary>
        /// 
        /// <param name="connection">
        /// An <see cref="AuthenticatedConnection"/> instance that creates the 
        /// new open query.
        /// </param>
        /// 
        /// <param name="searcher">
        /// A <see cref="HealthRecordSearcher"/> instance that defines the open query.
        /// </param>
        /// 
        /// <param name="pinCode">
        /// The PIN that protects the query.  
        /// </param>
        /// 
        /// <returns>
        /// An <see cref="OpenQuery"/> instance that represents the newly created query.
        /// </returns>
        /// 
        /// <remarks>
        /// The creation of an open query makes public the data returned by that 
        /// query. However, the query URL must be known to retrieve the data.
        /// </remarks>
        /// 
        /// <exception cref="ArgumentNullException">
        /// The <paramref name="connection"/> or <paramref name="searcher"/> 
        /// parameter is <b>null</b>.
        /// </exception>
        /// 
        /// <exception cref="ArgumentException">
        /// The <paramref name="searcher"/> parameter contains no valid search
        /// filters or the <paramref name="pinCode"/> parameter is <b>null</b> 
        /// or empty.
        /// </exception>
        /// 
        /// <exception cref="HealthServiceException">
        /// An error occurred when HealthVault processed the request.
        /// </exception>
        /// 
        public static OpenQuery NewQuery(
            AuthenticatedConnection connection,
            HealthRecordSearcher searcher,
            string pinCode)
        {
            Validator.ThrowIfStringNullOrEmpty(pinCode, "pinCode");

            return NewQuery(
                connection,
                searcher,
                Int32.MaxValue,
                pinCode,
                String.Empty,
                null);
        }
 /// <summary>
 /// Creates a new open query using the specified 
 /// <see cref="AuthenticatedConnection"/> and definition.
 /// </summary>
 /// 
 /// <param name="connection">
 /// An <see cref="AuthenticatedConnection"/> instance that creates the new open query.
 /// </param>
 /// 
 /// <param name="searcher">
 /// A <see cref="HealthRecordSearcher"/> instance that defines the open query.
 /// </param>
 /// 
 /// <returns>
 /// An <see cref="OpenQuery"/> instance that represents the newly created query.
 /// 
 /// </returns>
 /// 
 /// <remarks>
 /// The creation of an open query makes the data returned by that 
 /// query public. The only obscurity to the data is that the query
 /// URL must be known to retrieve it.
 /// </remarks>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="searcher"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="ArgumentException">
 /// The <paramref name="searcher"/> parameter contains no valid
 /// search filters.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public static OpenQuery NewQuery(
     AuthenticatedConnection connection,
     HealthRecordSearcher searcher)
 {
     return NewQuery(
         connection,
         searcher,
         Int32.MaxValue,
         String.Empty,
         String.Empty,
         null);
 }
 /// <summary>
 /// Removes the saved open query from the server.
 /// </summary>
 /// 
 /// <param name="connection">
 /// The connection instance to use to remove the <see cref="OpenQuery"/>.
 /// </param>
 /// 
 /// <remarks>
 /// The person authenticated with the <paramref name="connection"/> 
 /// must have permission to remove the open query.
 /// </remarks>
 /// 
 /// <exception cref="ArgumentNullException">
 /// The <paramref name="connection"/> parameter is <b>null</b>.
 /// </exception>
 /// 
 /// <exception cref="HealthServiceException">
 /// An error occurred when HealthVault processed the request.
 /// </exception>
 /// 
 public void Remove(AuthenticatedConnection connection)
 {
     HealthVaultPlatform.RemoveOpenQuery(connection, Id);
 }