What is a Dropbox API (v2) Union Tag?

2019-06-05 08:28发布

While starting to develop a Dropbox app using the Python SDK, I'm tripping conceptually over what the AccessLevel documentation calls a union tag. (The concept extends beyond the AccessLevel class, but this seems like as good an example as any.)

I'm trying to understand why the _tag attribute basically appears to be intended for internal use only. Why, if I want to know if a user has editor, owner, or viewer permission—-and it can only be one of those--I seem to be supposed to call the is_owner(), is_editor(), and is_viewer() methods until I get a True response.

What am I missing? Why wouldn't it be a good idea to just access the _tag attribute and go my merry way?

0条回答
登录 后发表回答