smartsheet-platform / smartsheet-python-sdk

Library that uses Python to connect to Smartsheet services (using API 2.0).
Apache License 2.0
136 stars 81 forks source link

filterId missing from sheets.py on get_sheet function #148

Closed dcitguy closed 4 years ago

dcitguy commented 4 years ago

Original -

    def get_sheet(self, sheet_id, include=None, exclude=None, row_ids=None,
                  row_numbers=None, column_ids=None, page_size=None, page=None, 
                  if_version_after=None, level=None):
        """Get the specified Sheet.

        Get the specified Sheet. Returns the Sheet, including Rows,
        and optionally populated with Discussion and Attachment
        objects.

        Args:
            sheet_id (int): Sheet ID
            include (list[str]): A comma-separated list of
                optional elements to include in the response. Valid list
                values: attachments, columnType, crossSheetReferences, discussions, filters,
                filterDefinitions, format, objectValue, ownerInfo, rowPermalink,
                rowWriterInfo (deprecated - use writerInfo), source, summary, writerInfo.
            exclude (str): Response will not include cells
                that have never contained any data.
            row_ids (list[int]): comma-separated list of Row
                IDs on which to filter the rows included in the result.
            row_numbers (list[int]): comma-separated list of
                Row numbers on which to filter the rows included in the
                result. Non-existent row numbers are ignored.
            column_ids (list[int]): comma-separated list of
                Column IDs. The response will contain only the specified
                columns in the 'columns' array, and individual rows' 'cells'
                array will only contain cells in the specified columns.
            page_size (int): The maximum number of items to
                return per page.
            page (int): Which page to return.
            if_version_after (int): only fetch Sheet if more recent version
                available.

        Returns:
            Sheet
        """
        _op = fresh_operation('get_sheet')
        _op['method'] = 'GET'
        _op['path'] = '/sheets/' + str(sheet_id)
        _op['query_params']['include'] = include
        _op['query_params']['exclude'] = exclude
        _op['query_params']['rowIds'] = row_ids
        _op['query_params']['rowNumbers'] = row_numbers
        _op['query_params']['columnIds'] = column_ids
        _op['query_params']['pageSize'] = page_size
        _op['query_params']['page'] = page
        _op['query_params']['ifVersionAfter'] = if_version_after
        _op['query_params']['level'] = level

        expected = 'Sheet'
        prepped_request = self._base.prepare_request(_op)
        response = self._base.request(prepped_request, expected, _op)

        return response

Corrected -

    def get_sheet(self, sheet_id, include=None, exclude=None, row_ids=None,
                  row_numbers=None, column_ids=None, page_size=None, page=None, 
                  if_version_after=None, level=None, filter_id=None):
        """Get the specified Sheet.

        Get the specified Sheet. Returns the Sheet, including Rows,
        and optionally populated with Discussion and Attachment
        objects.

        Args:
            sheet_id (int): Sheet ID
            include (list[str]): A comma-separated list of
                optional elements to include in the response. Valid list
                values: attachments, columnType, crossSheetReferences, discussions, filters,
                filterDefinitions, format, objectValue, ownerInfo, rowPermalink,
                rowWriterInfo (deprecated - use writerInfo), source, summary, writerInfo.
            exclude (str): Response will not include cells
                that have never contained any data.
            row_ids (list[int]): comma-separated list of Row
                IDs on which to filter the rows included in the result.
            row_numbers (list[int]): comma-separated list of
                Row numbers on which to filter the rows included in the
                result. Non-existent row numbers are ignored.
            column_ids (list[int]): comma-separated list of
                Column IDs. The response will contain only the specified
                columns in the 'columns' array, and individual rows' 'cells'
                array will only contain cells in the specified columns.
            page_size (int): The maximum number of items to
                return per page.
            page (int): Which page to return.
            if_version_after (int): only fetch Sheet if more recent version
                available.
            filter_id (int): Applies the given filter (if accessible by the calling user) 
                and marks the affected rows as "filteredOut": true

        Returns:
            Sheet
        """
        _op = fresh_operation('get_sheet')
        _op['method'] = 'GET'
        _op['path'] = '/sheets/' + str(sheet_id)
        _op['query_params']['include'] = include
        _op['query_params']['exclude'] = exclude
        _op['query_params']['rowIds'] = row_ids
        _op['query_params']['rowNumbers'] = row_numbers
        _op['query_params']['columnIds'] = column_ids
        _op['query_params']['pageSize'] = page_size
        _op['query_params']['page'] = page
        _op['query_params']['ifVersionAfter'] = if_version_after
        _op['query_params']['level'] = level
        _op['query_params']['filterId'] = filter_id

        expected = 'Sheet'
        prepped_request = self._base.prepare_request(_op)
        response = self._base.request(prepped_request, expected, _op)

        return response
Martin005 commented 4 years ago

@dcitguy Why didn't you just create a pull request with this change?

timwellswa commented 4 years ago

fixed