Пример #1
0
        internal static CredentialsResponse GetCredentials(
            string serverUrl,
            string unityToken)
        {
            Uri endpoint = PlasticWebApiUris.GetFullUri(
                new Uri(serverUrl),
                WebApiEndpoints.Authentication.Credentials,
                unityToken);

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(endpoint);
                request.Method      = "GET";
                request.ContentType = "application/json";

                return(GetResponse <CredentialsResponse>(request));
            }
            catch (Exception ex)
            {
                return(new CredentialsResponse
                {
                    Error = BuildLoggedErrorFields(ex, endpoint)
                });
            }
        }
Пример #2
0
        internal static NewVersion GetLastVersion(
            string serverUrl,
            Edition plasticEdition)
        {
            Uri endpoint = PlasticWebApiUris.GetFullUri(
                new Uri(serverUrl), string.Format(
                    WebApiEndpoints.LastVersion.NewVersion,
                    "9.0.0.0",
                    WebApiEndpoints.LastVersion.GetEditionString(plasticEdition),
                    WebApiEndpoints.LastVersion.GetPlatformString()));

            try
            {
                HttpWebRequest request = (HttpWebRequest)WebRequest.Create(endpoint);
                request.Method      = "GET";
                request.ContentType = "application/json";

                return(GetResponse <NewVersion>(request));
            }
            catch (Exception ex)
            {
                mLog.ErrorFormat(
                    "Unable to retrieve new versions from '{0}': {1}",
                    endpoint.ToString(), ex.Message);

                mLog.DebugFormat(
                    "StackTrace:{0}{1}",
                    Environment.NewLine, ex.StackTrace);

                return(null);
            }
        }