Austin.Linode.LinodeClient.User_GetApiKey C# (CSharp) Method

User_GetApiKey() public method

Authenticates a Linode Manager user against their username, password, and two-factor token (when enabled), and then returns a new API key, which can be used until it expires. The number of active keys is limited to 20. Batch requests will be rejected if they include this API action.
possible errors: AUTHFAIL,NEEDTOKEN,PASSWORDEXPIRED,KEYLIMIT
public User_GetApiKey ( string password, string username, int expires = null, string label = null, string token = null ) : void
password string
username string
expires int Number of hours the key will remain valid, between 0 and 8760. 0 means no expiration. Defaults to 168.
label string An optional label for this key.
token string Required when two-factor authentication is enabled.
return void
        public void User_GetApiKey(
                string password,
                string username,
                int? expires = null,
                string label = null,
                string token = null)
        {
            var myParams = new Dictionary<string, string>();
            myParams.Add("password", password);
            myParams.Add("username", username);
            if (expires != null)
                myParams.Add("expires", expires.Value.ToString(CultureInfo.InvariantCulture));
            if (label != null)
                myParams.Add("label", label);
            if (token != null)
                myParams.Add("token", token);
            GetResponse<object>("user.getapikey", myParams);
        }
    }