Exemple #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Adelex"/> class.
 /// </summary>
 /// <param name="account">The instance of the <see cref="Account"/>
 /// class to use to store the OAuth 2.0 account credentials.</param>
 /// <param name="text">The text to analyze.</param>
 /// <param name="order">The order the words in the text should be
 /// sorted as.</param>
 public Adelex(
     Account account,
     string text,
     AdelexOrder order)
     : base(
         Config.TellOPConfiguration.GetEndpointAsUri("TellOP.API.Adelex"),
         HttpMethod.Post,
         account,
         "text=" + Uri.EscapeDataString(text) + "&order=" + AdelexOrderExtensions.GetHttpParam(order))
 {
 }
Exemple #2
0
        /// <summary>
        /// Gets the HTTP parameter corresponding to the specified order value.
        /// </summary>
        /// <param name="order">The order value.</param>
        /// <returns>The HTTP parameter to be used in the <see cref="AdelexApi"/> API controller.</returns>
        public static string GetHttpParam(AdelexOrder order)
        {
            switch (order)
            {
            case AdelexOrder.Alphabetical:
                return("alphabetical");

            case AdelexOrder.Frequency:
                return("frequency");

            default:
                throw new ArgumentException("The order parameter is not a member of AdelexOrder", "order");
            }
        }