refactor api-ns generation stuff in helper macro