IO.Swagger.Client.Configuration.GetApiKeyWithPrefix C# (CSharp) Méthode

GetApiKeyWithPrefix() public méthode

Get the API key with prefix.
public GetApiKeyWithPrefix ( string apiKeyIdentifier ) : string
apiKeyIdentifier string API key identifier (authentication scheme).
Résultat string
        public string GetApiKeyWithPrefix(string apiKeyIdentifier)
        {
            var apiKeyValue = "";
            ApiKey.TryGetValue (apiKeyIdentifier, out apiKeyValue);
            var apiKeyPrefix = "";
            if (ApiKeyPrefix.TryGetValue (apiKeyIdentifier, out apiKeyPrefix))
                return apiKeyPrefix + " " + apiKeyValue;
            else
                return apiKeyValue;
        }

Usage Example

        public void TestAuthentication()
        {
            Configuration c = new Configuration ();
            c.Username = "******";
            c.Password = "******";

            c.ApiKey ["api_key_identifier"] = "1233456778889900";
            c.ApiKeyPrefix ["api_key_identifier"] = "PREFIX";
            Assert.AreEqual (c.GetApiKeyWithPrefix("api_key_identifier"), "PREFIX 1233456778889900");
        }