posit-dev / posit-sdk-py

Posit SDK for Python
https://posit-dev.github.io/posit-sdk-py/
MIT License
9 stars 4 forks source link

Access metrics.Views from Content? #182

Open nealrichardson opened 6 months ago

nealrichardson commented 6 months ago

From https://github.com/posit-dev/posit-sdk-py/pull/170#discussion_r1576380061, I feel like I wasn't conveying well that I was referring to Content and not ContentItem in bullet 2. Feel free to close if you hate the idea.

Currently, to get Views, you get .metrics from Client, and then .views from that. What if instead of going through .metrics you went through .content since Views are all about content:

class Content(Resources):
    ...
    @property
    def views(self) -> metrics.views.Views:
        return metrics.views.Views(self.config, self.session)

It's still across all content, unlike #181. It's just a question of ergonomics: do I expect to find all content metrics from something under .content or somewhere else?

tdstein commented 6 months ago

Oh, I see now; that makes sense since the views are scoped to content.