Dan Homola
07/27/2021, 7:38 AMimport { IAnalyticalBackend } from "@gooddata/sdk-backend-spi";
import { idRef, insightSetFilters } from "@gooddata/sdk-model";
// omitted for simplicity, the way to set up the bakcend object is sketched at <https://sdk.gooddata.com/gooddata-ui/docs/cloudnative_integration.html#step-3-set-up-analytical-backend-and-integrate-it-into-your-application>
const backend: IAnalyticalBackend = null;
const insight = await backend.workspace(WORKSPACE_ID).insights().getInsight(idRef(INSIGHT_REF));
const insightWithChanges = insightSetFilters(insight, FILTERS); // for example, you can modify the insight as you wish
const savedInsight = await backend.workspace(WORKSPACE_ID).insights().createInsight(insightWithChanges);
For all the methods available for the insights, you can either use your IDE (it should show you the options in the automatic suggestions) or if you prefer static API reference, it is available here.
Hope this helps!