Custom Texture Sampler Node

Is there a way to build a custom Texture Sampler?
I practically need the same as the Image Texture node but i need a NodeSocketImage as input
like the Sampler in the Geometry Node Editor Attribute Sample Texture Node — Blender Manual

I cant’d find any part of the api that allow me to sample a image