Set SetInnerConeAngle on a spotlight


I’m creating lights with C++ in the editor using ASpotLight and want to set the cone angles, but the code says those methods are deprecated and don’t work.
Here’s my code sample:

ASpotLight* SpotLight = Cast<ASpotLight>(GEditor->AddActor(GEditor->GetEditorWorldContext().World()->GetCurrentLevel(), ASpotLight::StaticClass(), LightPosition));

The comment in the code says to use “component functions”.

My question is, how can I convert my code so I can set the cone angles of my lights?