Exemplo n.º 1
0
 /// <summary>
 /// Initializes the VcRestClient.
 /// </summary>
 /// <param name="accountId">Account ID.</param>
 /// <param name="apiKey">API key.</param>
 /// <param name="apiSecret">API secret.</param>
 /// <param name="apiBaseUrl">API base URL.</param>
 public static void Init(int accountId, string apiKey, string apiSecret, string apiBaseUrl = "https://api.vivialconnect.net/api/v1.0/")
 {
     _accountId  = accountId;
     _apiKey     = apiKey;
     _apiSecret  = apiSecret;
     _apiBaseUrl = apiBaseUrl;
     _restClient = null;
 }
Exemplo n.º 2
0
        /// <summary>
        /// The REST client.
        /// </summary>
        /// <returns></returns>
        /// <exception cref="AuthenticationException">Initialize VcClient before attempting to use any Resource.</exception>
        public static VcRestClient GetRestClient()
        {
            if (_restClient != null)
            {
                return(_restClient);
            }

            if (string.IsNullOrWhiteSpace(_apiKey) ||
                string.IsNullOrWhiteSpace(_apiSecret))
            {
                throw new AuthenticationException(
                          "Initialize VcClient before attempting to use any Resource."
                          );
            }

            _restClient = new VcRestClient(_apiKey, _apiSecret, _apiBaseUrl);
            return(_restClient);
        }