コード例 #1
0
        /// <summary>
        /// Gets the public media for the loggedin user. This corresponds to the
        /// media.getPublic Hyves method.
        /// </summary>
        /// <param name="sortType">The sorttype</param>
        /// <param name="mediaType">The media type of the results.</param>
        /// <param name="timeSpan">The timespan to select from.</param>
        /// <param name="responsefields">Get extra information from the media.</param>
        /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
        /// <param name="page">The requested page.</param>
        /// <param name="resultsPerPage">The number of results per page.</param>
        /// <returns>The information about the specified media; null if the call fails.</returns>
        public Collection <Media> GetPublic(HyvesSortType sortType, HyvesMediaType mediaType, HyvesTimeSpan timeSpan, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
        {
            if (sortType == HyvesSortType.NotSpecified)
            {
                throw new ArgumentOutOfRangeException("sortType");
            }

            if (mediaType == HyvesMediaType.Unknown)
            {
                throw new ArgumentOutOfRangeException("mediaType");
            }

            HyvesRequest request = new HyvesRequest(this.session);

            request.Parameters["sorttype"]  = EnumHelper.GetDescription(sortType);
            request.Parameters["mediatype"] = EnumHelper.GetDescription(mediaType);
            if (timeSpan == HyvesTimeSpan.NotSpecified)
            {
                request.Parameters["timespan"] = EnumHelper.GetDescription(timeSpan);
            }

            request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

            HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetPublic, useFancyLayout, page, resultsPerPage);

            if (response.Status == HyvesResponseStatus.Succeeded)
            {
                return(response.ProcessResponse <Media>("media"));
            }

            return(null);
        }
    /// <summary>
    /// Gets the public media for the loggedin user. This corresponds to the
    /// media.getPublic Hyves method.
    /// </summary>
    /// <param name="sortType">The sorttype</param>
    /// <param name="mediaType">The media type of the results.</param>
    /// <param name="timeSpan">The timespan to select from.</param>
    /// <param name="responsefields">Get extra information from the media.</param>
    /// <param name="useFancyLayout">Display information the same way that that is being done on the site, including things like smilies.</param>
    /// <param name="page">The requested page.</param>
    /// <param name="resultsPerPage">The number of results per page.</param>
    /// <returns>The information about the specified media; null if the call fails.</returns>
    public Collection<Media> GetPublic(HyvesSortType sortType, HyvesMediaType mediaType, HyvesTimeSpan timeSpan, HyvesMediaResponsefield responsefields, bool useFancyLayout, int page, int resultsPerPage)
    {
      if (sortType == HyvesSortType.NotSpecified)
      {
        throw new ArgumentOutOfRangeException("sortType");
      }

      if (mediaType == HyvesMediaType.Unknown)
      {
        throw new ArgumentOutOfRangeException("mediaType");
      }
            
      HyvesRequest request = new HyvesRequest(this.session);
      request.Parameters["sorttype"] = EnumHelper.GetDescription(sortType);
      request.Parameters["mediatype"] = EnumHelper.GetDescription(mediaType);
      if (timeSpan == HyvesTimeSpan.NotSpecified)
      {
        request.Parameters["timespan"] = EnumHelper.GetDescription(timeSpan);
      }

      request.Parameters["ha_responsefields"] = ConvertResponsefieldsToString(responsefields);

      HyvesResponse response = request.InvokeMethod(HyvesMethod.MediaGetPublic, useFancyLayout, page, resultsPerPage);
      if (response.Status == HyvesResponseStatus.Succeeded)
      {
        return response.ProcessResponse<Media>("media");
      }

      return null;
    }