<commit_before>from .endpoint import Endpoint, api
from .exceptions import MissingRequiredFieldError
from .resource_tagger import _ResourceTagger
from .. import RequestFactory, ViewItem, PaginationItem
from ...models.tag_item import TagItem
import logging

logger = logging.getLogger('tableau.endpoint.views')


class Views(Endpoint):
    def __init__(self, parent_srv):
        super(Views, self).__init__(parent_srv)
        self._resource_tagger = _ResourceTagger(parent_srv)

    # Used because populate_preview_image functionaliy requires workbook endpoint
    @property
    def siteurl(self):
        return "{0}/sites/{1}".format(self.parent_srv.baseurl, self.parent_srv.site_id)

    @property
    def baseurl(self):
        return "{0}/views".format(self.siteurl)

    def get(self, req_options=None):
        logger.info('Querying all views on site')
        server_response = self.get_request(self.baseurl, req_options)
        pagination_item = PaginationItem.from_response(server_response.content)
        all_view_items = ViewItem.from_response(server_response.content)
        return all_view_items, pagination_item
<commit_msg>Add api annotation to all current endpoints (#125)<commit_after>from .endpoint import Endpoint, api
from .exceptions import MissingRequiredFieldError
from .resource_tagger import _ResourceTagger
from .. import RequestFactory, ViewItem, PaginationItem
from ...models.tag_item import TagItem
import logging

logger = logging.getLogger('tableau.endpoint.views')


class Views(Endpoint):
    def __init__(self, parent_srv):
        super(Views, self).__init__(parent_srv)
        self._resource_tagger = _ResourceTagger(parent_srv)

    # Used because populate_preview_image functionaliy requires workbook endpoint
    @property
    def siteurl(self):
        return "{0}/sites/{1}".format(self.parent_srv.baseurl, self.parent_srv.site_id)

    @property
    def baseurl(self):
        return "{0}/views".format(self.siteurl)

    @api(version="2.2")
    def get(self, req_options=None):
        logger.info('Querying all views on site')
        server_response = self.get_request(self.baseurl, req_options)
        pagination_item = PaginationItem.from_response(server_response.content)
        all_view_items = ViewItem.from_response(server_response.content)
        return all_view_items, pagination_item

{'fraction_non_alphanumeric': 0.09032807839795484, 'fraction_numerical': 0.004686834256497656, 'mean_word_length': 4.288288288288288, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5996119', 'n_tokens_mistral': 704, 'n_tokens_neox': 675, 'n_words': 150}