Setup/Modify Tileset Terrain through gdscript

Godot Version

Godot 4.3

Question

Hello,
How do I access the tileset’s terrains data through gdscript?

I searched everywhere in the documentation and on the internet.
I know about TileBit Tools and it kind of helped me, but to use it I still have to do in the editor.
I also looked inside their source code but coudn’t understand how it works to access and modify the tileset’s terrain data.