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

Methods for extending the API #13

Open
kk6 opened this issue Apr 14, 2017 · 0 comments
Open

Methods for extending the API #13

kk6 opened this issue Apr 14, 2017 · 0 comments

Comments

@kk6
Copy link
Owner

kk6 commented Apr 14, 2017

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])
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant