Using the api to make a generator block?