It depends on exactly how you want to qualify "machine" and "version".
For the specific case of "a Mac mini", I would probably use the sysctl name "hw.model", which in the case of a Mac mini would return a C string like "Macmini1,1" or "Macmini2,1". Because all models of Mac mini (well Intel-based) have the string "Macmini", that's what I'd look for. Specific models over time have different "n,m" values, so if that's what you mean by "version", then use that. Otherwise you'll have to describe exactly what "version" represents.
If I had to qualify PowerPC-based Mac minis, I'm not sure if sysctl hw.model would work or not, I'd have to test it first.
There are a lot of other hardware qualifiers in the "hw" family of sysctl names. See the man page for sysctl. There's both a command called sysctl, as well as a C function. So if you're shell scripting or AppleScripting, use the command. Otherwise use the C function. And you'll probably want to use the C function sysctlbyname, because figuring out sysctl's MIB stuff is way too hard unless you're really hard-core.