InitializeToken() public method

Initializes the session information once a session has been created.
public InitializeToken ( string token, string tokenSecret, System.DateTime expireDate ) : void
token string The unique identifier of the session.
tokenSecret string The secret of the session.
expireDate System.DateTime
return void
        private static HttpWebRequest CreateRequest(string requestToken, string requestTokenSecret, HyvesExpirationType expirationType, HyvesSession session)
        {
            HyvesRequestParameterList parameters = new HyvesRequestParameterList();
            HyvesMethod method;

            if (string.IsNullOrEmpty(requestToken))
            {
                method = HyvesMethod.AuthRequesttoken;

                StringBuilder methodsStringBuilder = new StringBuilder();

                if (session.Methods.Contains(HyvesMethod.All))
                {
                    Array hyvesMethodValues = Enum.GetValues(typeof(HyvesMethod));
                    foreach (HyvesMethod hyvesMethod in hyvesMethodValues)
                    {
                        if (hyvesMethod != HyvesMethod.Unknown)
                        {
                            methodsStringBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(hyvesMethod)));
                        }
                    }

                    methodsStringBuilder = methodsStringBuilder.Replace(
                        string.Format("{0},", EnumHelper.GetDescription(HyvesMethod.All)),
                        string.Empty);
                }
                else
                {
                    foreach (HyvesMethod hyvesMethod in session.Methods)
                    {
                        methodsStringBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(hyvesMethod)));
                    }
                }

                string methods = methodsStringBuilder.ToString();
                parameters["methods"] = methods.Substring(0, methods.Length - 1);

                parameters["expirationtype"] = EnumHelper.GetDescription(expirationType);
            }
            else
            {
                session.InitializeToken(requestToken, requestTokenSecret, DateTime.MinValue);
                method = HyvesMethod.AuthAccesstoken;
            }

            HttpWebRequest request = (HttpWebRequest)WebRequest.Create(HyvesHttpUri);

            parameters.InitializeRequest(request, method, session);

            return(request);
        }
    private static HttpWebRequest CreateRequest(string requestToken, string requestTokenSecret, HyvesExpirationType expirationType, HyvesSession session)
    {
      HyvesRequestParameterList parameters = new HyvesRequestParameterList();
      HyvesMethod method;

      if (string.IsNullOrEmpty(requestToken))
      {
        method = HyvesMethod.AuthRequesttoken;

        StringBuilder methodsStringBuilder = new StringBuilder();

        if (session.Methods.Contains(HyvesMethod.All))
        {
          Array hyvesMethodValues = Enum.GetValues(typeof(HyvesMethod));
          foreach (HyvesMethod hyvesMethod in hyvesMethodValues)
          {
            if (hyvesMethod != HyvesMethod.Unknown)
            {
              methodsStringBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(hyvesMethod)));
            }
          }

          methodsStringBuilder=methodsStringBuilder.Replace(
            string.Format("{0},", EnumHelper.GetDescription(HyvesMethod.All)),
            string.Empty);
        }
        else
        {
          foreach (HyvesMethod hyvesMethod in session.Methods)
          {
            methodsStringBuilder.Append(string.Format("{0},", EnumHelper.GetDescription(hyvesMethod)));
          }
        }

        string methods = methodsStringBuilder.ToString();
        parameters["methods"] = methods.Substring(0, methods.Length - 1);

        parameters["expirationtype"] = EnumHelper.GetDescription(expirationType);
      }
      else
      {
        session.InitializeToken(requestToken, requestTokenSecret, DateTime.MinValue);
        method = HyvesMethod.AuthAccesstoken;
      }

      HttpWebRequest request = (HttpWebRequest)WebRequest.Create(HyvesHttpUri);
      parameters.InitializeRequest(request, method, session);

      return request;
    }