Creating hair particle cache

In blender 2.79 we could use code below to create particle hair cache:

bpy.ops.particle.particle_edit_toggle()
bpy.ops.particle.brush_edit( stroke=[{"name": "", "location": (0, 0, 0), "mouse": (11, 11), "pressure": 0, "size": 0, "pen_flip": False, "time": 0, "is_start": False}])
bpy.ops.particle.particle_edit_toggle()

But it blender 2.8 bpy.ops.particle.brush_edit throws poll error (bad context). Any ideas how to fix it, or how generate hair combing cache in 2.8?