示例#1
0
    def stats(self, date=None, season=None, week=None):
        """Updates the path to include the 'stats' sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.

        This method supports changing the requested scope for player
        stats, but only one of `date`, `season`, or `week` can be
        provided.

        Parameters
        ----------
        date: str
            The value to indicate the date of the player stats to return.
            If a value is provided this will add a `;type=date;date=<value>`
            filter. The date must be provided in a 'YYYY-MM-DD' format.
        season: int
            The value to indicate the season of the players stats to return.
            If a value is provided this will add a `;type=season;season=<value>`
            filter.
        week:int
            The value to indicate the week of the players stats to return.
            If a value is provided this will add a `;type=week;week=<value>`
            filter.
        """
        coverage_filter = self.__build_coverage_filter(date, season, week)
        self.__parent_api.path += f'/stats{coverage_filter}'
        return TerminalApi(self.__parent_api)
示例#2
0
    def meta(self):
        """Leaves the path empty to make the call return meta information

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        return TerminalApi(self)
示例#3
0
    def percent_owned(self):
        """Updates the path to include the 'percent_owned' sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.__parent_api.path += '/percent_owned'
        return TerminalApi(self.__parent_api)
示例#4
0
    def stat_categories(self):
        """Updates the path to include the `stat_categories` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.path += '/stat_categories'
        return TerminalApi(self)
示例#5
0
    def draft_analysis(self):
        """Updates the path to include the 'draft_analysis' sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.__parent_api.path += '/draft_analysis'
        return TerminalApi(self.__parent_api)
示例#6
0
    def teams(self):
        """Updates the path to include the `teams` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.path += '/teams'
        return TerminalApi(self)
示例#7
0
    def roster_positions(self):
        """Updates the path to include the `roster_positions` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.path += '/roster_positions'
        return TerminalApi(self)
示例#8
0
    def stats(self):
        """Updates the path to include the 'stats' sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.__parent_api.path += '/players/stats'
        return TerminalApi(self.__parent_api)
示例#9
0
    def draft_results(self):
        """Updates the path to include the `draftresults` sub-resource

        The draft results will include the `players` sub-resource in the
        response automatically.

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """
        self.path += '/draftresults/players'
        return TerminalApi(self)
示例#10
0
    def stats(self, week=None):
        """Updates the path to include the `stats` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.
        """

        self.path += '/stats'

        if week:
            self.path += f';type=week;week={week}'  # pragma: no cover
        return TerminalApi(self)
示例#11
0
    def transactions(self, ttype=None, team_id=None, count=None, start=None):
        """Updates the path to include the `transactions` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.

        Parameters
        ----------
        ttype: str
            The value to indicate what type of transactions to return
            in the list. If a value is provided, this will add a
            `;type=<value` filter to the path. The accepted values are
            'add' (returns add, drop, and add/drop), 'drop' (returns
            add, drop, and add/drop), 'commish', and 'trade'. The values
            'waiver' and 'pending_trade' are also accepted, but require
            the `team_id` parameter to be provided as well.
        team_id: int
            The id of the team to use when filtering the list. If a value
            is provided, this will add a `;team_key=<gm>.l.<lg>.<value>`.
            For simplicity the id is converted into a key for the filter.
        count: int
            The value to indicate how many transactions to return in the
            list. Unlike the players collection, there doesn't seem to be
            a maximum value for transactions. (default: 25)
        start: int
            The value to indicate what offset to start the transactions
            list at. For example: `start=0` begins at the most recent
            transaction while `start=1` begins at the second most recent.
            (default: 0)
        """
        self.path += '/transactions'

        if ttype in ['waiver', 'pending_trade'] and not team_id:
            raise Exception(
                f'\'team_id\' must be provided when using \'{ttype}\'.')

        if ttype:
            self.path += f';type={ttype}'
        if team_id:
            self.path += f';team_key={self.__league_key}.t.{team_id}'
        if count:
            self.path += f';count={count}'
        if start:
            self.path += f';start={start}'

        return TerminalApi(self)
示例#12
0
    def scoreboard(self, week=None):
        """Updates the path to include the `scoreboard` sub-resource

        Returns a TerminalApi object that provides a `get()` call to
        invoke the query.

        Parameters
        ----------
        week: int
            If a value is provided this will add a `week=<value>`
            filter to the path that filters the results by week.
            If nothing is provided the server will default to the
            current week.
        """
        self.path += '/scoreboard'

        if week:
            self.path += f';week={week}'

        return TerminalApi(self)
示例#13
0
 def draft_analysis(self):
     self.__parent_api.path += '/players/draft_analysis'  # pragma: no cover
     return TerminalApi(self.__parent_api)  # pragma: no cover
示例#14
0
 def percent_owned(self):
     self.__parent_api.path += '/players/percent_owned'  # pragma: no cover
     return TerminalApi(self.__parent_api)  # pragma: no cover