Postgres functions: how to pass a type as an argument
It is possible:

create type mood as enum ('sad','ok', 'happy');
CREATE TYPE

create function f(p_typname text) returns setof text 
as $$
begin
   return query execute 
      format(
         'SELECT unnest(enum_range(null:: %s))::text AS enum_values',
         p_typname
      );
end;
$$
language plpgsql;
CREATE FUNCTION

select * from f('mood');
   f   
-------
 sad
 ok
 happy
(3 rows)