Internalizing protobuf and internal data for API encapsulation