# Client Specification 1.0 This document describes the client contract. ## The basics All client implementations should strive to have a simple and consistent user API. It should be a simple method, called isEnabled, to check if a feature toggle is enabled or not. The method should return a `boolean` value, true or false. ``` unleash.isEnabled("myAwesomeToggle") ``` The basic `isEnabled` method should also accept a default value. This should be used if the client does not know anything about that that toggle name. If the user does not specify a default value, false should be returned for unknown feature toggles. Example: ``` boolean value = unleash.isEnabled("unknownFeatureToggle", false); //value==false because default value was used. ``` ### Implementation of isEnabled A feature toggle is defined as: ```json { "name": "Feature.B", "description": "lorem ipsum", "enabled": true, "strategies": [ { "name": "ActiveForUserWithId", "parameters": { "userIdList": "123,221,998" } }, { "name": "GradualRolloutRandom", "parameters": { "percentage": "10" } } ], "strategy": "ActiveForUserWithId", "parameters": { "userIdList": "123,221,998" } } ``` A simple demo of the isEnable function in JavaScript-style (most implementation will probalby be more functional): ```javascript function isEnabled(name, defaultValue) { const toggle = toggleRepository.get(name); let enabled = false; if ( !toggle ) { return defaultValue; } else if ( ! toggle.isEnabled) { return false; } else { for(let i=0;i