GetConfigWithDefaults() public static méthode

Creates new configuration that combines incoming configuration dictionary and defaults
public static GetConfigWithDefaults ( string>.Dictionary config ) : string>.Dictionary
config string>.Dictionary
Résultat string>.Dictionary
Exemple #1
0
        /// <summary>
        /// Client Id and Secret for the OAuth
        /// </summary>
        /// <param name="clientId"></param>
        /// <param name="clientSecret"></param>
        /// <param name="config"></param>
        public OAuthTokenCredential(string clientId = "", string clientSecret = "", Dictionary <string, string> config = null)
        {
            this.config = config != null?ConfigManager.GetConfigWithDefaults(config) : ConfigManager.GetConfigWithDefaults(ConfigManager.Instance.GetProperties());

            // Set the client ID.
            if (string.IsNullOrEmpty(clientId))
            {
                this.ClientId = this.config.ContainsKey(BaseConstants.ClientId) ? this.config[BaseConstants.ClientId] : string.Empty;
            }
            else
            {
                this.ClientId = clientId;
                this.config[BaseConstants.ClientId] = clientId;
            }

            // Set the client secret.
            if (string.IsNullOrEmpty(clientSecret))
            {
                this.ClientSecret = this.config.ContainsKey(BaseConstants.ClientSecret) ? this.config[BaseConstants.ClientSecret] : string.Empty;
            }
            else
            {
                this.ClientSecret = clientSecret;
                this.config[BaseConstants.ClientSecret] = clientSecret;
            }

            this.SdkVersion = new SDKVersion();
            this.AccessTokenExpirationSafetyGapInSeconds = 120; // Default is 2 minute safety gap for token expiration.
        }
 /// <summary>
 /// RESTAPICallPreHandler taking dynamic configuration Dictionary and HTTP Headers Dictionary
 /// </summary>
 /// <param name="config">Dictionary for dynamic configuration</param>
 /// <param name="headersMap">Dictionary for HTTP Headers</param>
 public RESTAPICallPreHandler(Dictionary <string, string> config, Dictionary <string, string> headersMap)
 {
     this.config     = ConfigManager.GetConfigWithDefaults(config);
     this.headersMap = (headersMap == null) ? new Dictionary <string, string>() : headersMap;
 }
Exemple #3
0
 /// <summary>
 /// Gets the stored configuration and merges it with the application's default config.
 /// </summary>
 /// <returns></returns>
 public Dictionary <string, string> GetConfigWithDefaults()
 {
     return(ConfigManager.GetConfigWithDefaults(this.Config)); // ?? ConfigManager.Instance.GetProperties());
 }
 /// <summary>
 /// RESTAPICallPreHandler taking dynamic configuration Dictionary
 /// </summary>
 /// <param name="config">Dictionary for dynamic configuration</param>
 public RESTAPICallPreHandler(Dictionary <string, string> config)
 {
     this.config = ConfigManager.GetConfigWithDefaults(config);
 }