コード例 #1
0
ファイル: HttpRequest.cs プロジェクト: dxm007/TrackerSync
        /// <summary>
        /// To be called by a deriving class when the request is to be executed
        /// </summary>
        /// <param name="baseUrlType">Identifies the base URL which is to be used for the request</param>
        /// <param name="suffixFormat">Suffix format string to be tacked onto the end of a request URL</param>
        /// <param name="args">Arguments for the format string</param>
        protected void SendRequest( BaseHttpReqUrlType  baseUrlType,
                                    string              suffixFormat,
                                    params object[]     args          )
        {
            string url = BuildApiPath( baseUrlType, suffixFormat, args );

            base.SendRequest( url, SourceSettings.Credentials );
        }
コード例 #2
0
ファイル: HttpRequest.cs プロジェクト: dxm007/TrackerSync
 private string BuildApiPath( BaseHttpReqUrlType    baseUrlType,
                              string                suffixFormat,
                              params object[]       args          )
 {
     if( baseUrlType == BaseHttpReqUrlType.Repo )
     {
         return string.Format( "{0}/repos/{1}/{2}{3}",
                               SourceSettings.ApiServerUrl, SourceSettings.UserName,
                               SourceSettings.RepoName, string.Format( suffixFormat, args ) );
     }
     else if( baseUrlType == BaseHttpReqUrlType.None )
     {
         return SourceSettings.ApiServerUrl + string.Format( suffixFormat, args );
     }
     else
     {
         return string.Format( suffixFormat, args );
     }
 }