created a factory for our api