-
-
Notifications
You must be signed in to change notification settings - Fork 54
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: integrate dependency injection with kink library (#859)
* feat: integrate dependency injection with kink library - Added dependency injection using the kink library to manage API instances and service initialization. - Updated various modules to utilize dependency injection for better modularity and testability. - Refactored API initialization and validation logic to be more centralized and consistent. - Enhanced Trakt, Plex, Overseerr, Mdblist, and Listrr services to use injected dependencies. - Updated CLI and service modules to align with the new dependency injection approach. - Modified pyproject.toml to include kink as a dependency. * feat: enhance Trakt API with OAuth support and settings integration - Updated TraktAPI to accept settings via TraktModel, enabling OAuth configuration. - Added OAuth flow methods to handle authorization and token exchange. - Integrated TraktOauthModel into TraktModel for structured OAuth settings. - Modified API bootstrap to pass settings to TraktAPI. - Ensured backward compatibility with existing settings structure. * fix: assignment of trakt api key in oauth * fix: duplicate import * fix: correct TraktAPI settings initialization in constructor
- Loading branch information
1 parent
c80f609
commit ed5fb2c
Showing
19 changed files
with
176 additions
and
95 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,42 @@ | ||
from .listrr_api import ListrrAPI, ListrrAPIError | ||
from .trakt_api import TraktAPI, TraktAPIError | ||
from .plex_api import PlexAPI, PlexAPIError | ||
from .overseerr_api import OverseerrAPI, OverseerrAPIError | ||
from .mdblist_api import MdblistAPI, MdblistAPIError | ||
from program.settings.manager import settings_manager | ||
from kink import di | ||
|
||
def bootstrap_apis(): | ||
__setup_trakt() | ||
__setup_plex() | ||
__setup_mdblist() | ||
__setup_overseerr() | ||
__setup_listrr() | ||
|
||
def __setup_trakt(): | ||
traktApi = TraktAPI(settings_manager.settings.content.trakt) | ||
di[TraktAPI] = traktApi | ||
|
||
def __setup_plex(): | ||
if not settings_manager.settings.updaters.plex.enabled: | ||
return | ||
plexApi = PlexAPI(settings_manager.settings.updaters.plex.token, settings_manager.settings.updaters.plex.url) | ||
di[PlexAPI] = plexApi | ||
|
||
def __setup_overseerr(): | ||
if not settings_manager.settings.content.overseerr.enabled: | ||
return | ||
overseerrApi = OverseerrAPI(settings_manager.settings.content.overseerr.api_key, settings_manager.settings.content.overseerr.url) | ||
di[OverseerrAPI] = overseerrApi | ||
|
||
def __setup_mdblist(): | ||
if not settings_manager.settings.content.mdblist.enabled: | ||
return | ||
mdblistApi = MdblistAPI(settings_manager.settings.content.mdblist.api_key) | ||
di[MdblistAPI] = mdblistApi | ||
|
||
def __setup_listrr(): | ||
if not settings_manager.settings.content.listrr.enabled: | ||
return | ||
listrrApi = ListrrAPI(settings_manager.settings.content.listrr.api_key) | ||
di[ListrrAPI] = listrrApi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.