Couchbase.N1QL.QueryRequest.AddCredentials C# (CSharp) Method

AddCredentials() public method

Adds a set of credentials to the list of credentials, in the form of user/password
Optional.
username;cannot be null, empty or whitespace.
public AddCredentials ( string username, string password, bool isAdmin ) : IQueryRequest
username string The bucket or username.
password string The password of the bucket.
isAdmin bool True if connecting as an admin.
return IQueryRequest
        public IQueryRequest AddCredentials(string username, string password, bool isAdmin)
        {
            if (string.IsNullOrWhiteSpace(username))
            {
                throw new ArgumentOutOfRangeException("username", "cannot be null, empty or whitespace.");
            }
            if (isAdmin && !username.StartsWith("admin:"))
            {
                username = "admin:" + username;
            }
            else if(!username.StartsWith("local:"))
            {
                username = "local:" + username;
            }
            _credentials.Add(username, password);
            return this;
        }