Skip to content
This repository was archived by the owner on Dec 27, 2024. It is now read-only.
This repository was archived by the owner on Dec 27, 2024. It is now read-only.

Methods for extending the API #13

Description

@kk6

At the moment, the annict.api.API class implements only the method corresponding to the Annict API endpoint (exchanging direct communication with the API).

Although we use these conditions as parameters for the purpose and use it, sometimes there are requests that you know that you specify the same parameters every time (eg "I'd like to acquire the work list for the current season" etc.)

>>> api.works(filter_season='2017-spring', sort_watchers_count='desc')

It would be better to provide those with such a high possibility of being frequently used as shortcuts.

>>> api.get_works_for_current_season(sort_watchers_count='desc')

More examples

>>> api.get_ranking_for_current_season(sort_by='watchers')
>>> api.get_my_works_for_current_season(status='wanna_watch')
>>> api.batch_record(episode_ids=[3, 4, 5])
>>> api.bulk_record(work_id=123)  # Record all episodes of the work
>>> api.batch_update_status(work_ids=[123, 456, 789], status='wanna_watch')

Or, instead of extending the API class, prepare a module called annict.shortcuts and list functions there.

>>> from annict.shortcuts import batch_record
>>> batch_record(api, episode_ids=[3, 4, 5])

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions