client state api and function