-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #118 from tommydeboer/feature/api
Move API endpoints from the config file to the code
- Loading branch information
Showing
24 changed files
with
324 additions
and
176 deletions.
There are no files selected for viewing
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 |
---|---|---|
@@ -0,0 +1,70 @@ | ||
from urllib.parse import urljoin, quote | ||
|
||
from mcmd.config import config | ||
|
||
|
||
def endpoint(func): | ||
def wrapper(*args, **kwargs): | ||
return urljoin(config.get('host', 'selected'), quote(func(*args, **kwargs))) | ||
|
||
return wrapper | ||
|
||
|
||
@endpoint | ||
def rest1(path: str): | ||
return urljoin('api/v1/', path) | ||
|
||
|
||
@endpoint | ||
def rest2(path: str): | ||
return urljoin('api/v2/', path) | ||
|
||
|
||
@endpoint | ||
def login(): | ||
return 'api/v1/login/' | ||
|
||
|
||
@endpoint | ||
def group(): | ||
return 'api/plugin/security/group/' | ||
|
||
|
||
@endpoint | ||
def member(group_name): | ||
return 'api/plugin/security/group/{}/member/'.format(group_name) | ||
|
||
|
||
@endpoint | ||
def import_(): | ||
return 'plugin/importwizard/importFile/' | ||
|
||
|
||
@endpoint | ||
def import_by_url(): | ||
return 'plugin/importwizard/importByUrl/' | ||
|
||
|
||
@endpoint | ||
def permissions(): | ||
return 'menu/admin/permissionmanager/update/' | ||
|
||
|
||
@endpoint | ||
def rls(): | ||
return 'menu/admin/permissionmanager/update/entityclass/rls' | ||
|
||
|
||
@endpoint | ||
def add_theme(): | ||
return 'plugin/thememanager/add-bootstrap-theme' | ||
|
||
|
||
@endpoint | ||
def set_theme(): | ||
return 'plugin/thememanager/set-bootstrap-theme' | ||
|
||
|
||
@endpoint | ||
def logo(): | ||
return 'plugin/menumanager/upload-logo' |
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.