Merge pull request #378 from SamR1/docs-i18n
Init documentation translation
This commit is contained in:
@ -58,8 +58,8 @@ def get_application_config() -> Union[Dict, HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 500: error on getting configuration
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 500: ``error on getting configuration``
|
||||
"""
|
||||
|
||||
try:
|
||||
@ -125,15 +125,15 @@ def update_application_config(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- valid email must be provided for admin contact
|
||||
:statuscode 403: you do not have permissions
|
||||
:statuscode 500: error when updating configuration
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
- ``valid email must be provided for admin contact``
|
||||
:statuscode 403: ``you do not have permissions``
|
||||
:statuscode 500: ``error when updating configuration``
|
||||
"""
|
||||
config_data = request.get_json()
|
||||
if not config_data:
|
||||
@ -209,6 +209,6 @@ def health_check() -> Union[Dict, HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
"""
|
||||
return {'status': 'success', 'message': 'pong!'}
|
||||
|
@ -47,14 +47,14 @@ def get_clients(auth_user: User) -> Dict:
|
||||
|
||||
**Example request**:
|
||||
|
||||
- without parameters
|
||||
- without parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/oauth/apps HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
- with 'page' parameter
|
||||
- with 'page' parameter:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -99,11 +99,11 @@ def get_clients(auth_user: User) -> Dict:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
params = request.args.copy()
|
||||
page = int(params.get('page', 1))
|
||||
@ -177,17 +177,16 @@ def create_client(auth_user: User) -> Union[HttpResponse, Tuple[Dict, int]]:
|
||||
:json string client_uri: client URL
|
||||
:json array redirect_uri: list of client redirect URLs (string)
|
||||
:json string scope: client scopes
|
||||
:json string client_description: client description (`OPTIONAL`)
|
||||
:json string client_description: client description (optional)
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
client_metadata = request.get_json()
|
||||
if not client_metadata:
|
||||
@ -268,7 +267,7 @@ def get_client_by_client_id(
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -293,7 +292,7 @@ def get_client_by_client_id(
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- not found
|
||||
- not found:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -309,12 +308,12 @@ def get_client_by_client_id(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: OAuth2 client not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``OAuth2 client not found``
|
||||
"""
|
||||
return get_client(
|
||||
auth_user, client_id=None, client_client_id=client_client_id
|
||||
@ -341,7 +340,7 @@ def get_client_by_id(
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -366,7 +365,7 @@ def get_client_by_id(
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- not found
|
||||
- not found:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -382,12 +381,12 @@ def get_client_by_id(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: OAuth2 client not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``OAuth2 client not found``
|
||||
"""
|
||||
return get_client(auth_user, client_id=client_id, client_client_id=None)
|
||||
|
||||
@ -423,10 +422,10 @@ def delete_client(
|
||||
|
||||
:statuscode 204: OAuth2 client deleted
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: OAuth2 client not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``OAuth2 client not found``
|
||||
"""
|
||||
client = OAuth2Client.query.filter_by(
|
||||
id=client_id,
|
||||
@ -474,12 +473,12 @@ def revoke_client_tokens(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: OAuth2 client not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``OAuth2 client not found``
|
||||
"""
|
||||
client = OAuth2Client.query.filter_by(id=client_id).first()
|
||||
|
||||
@ -534,14 +533,14 @@ def authorize(auth_user: User) -> Union[HttpResponse, Dict]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- ``invalid payload``
|
||||
- errors returned by Authlib library
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
data = request.form
|
||||
if (
|
||||
@ -603,13 +602,12 @@ def issue_token() -> Response:
|
||||
(for token issue with PKCE, not mandatory)
|
||||
:form string refresh_token: refresh token (for token refresh)
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400:
|
||||
- errors returned by Authlib library
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: errors returned by Authlib library
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
return authorization_server.create_token_response()
|
||||
|
||||
@ -639,12 +637,11 @@ def revoke_token() -> Response:
|
||||
:form string client_secret: OAuth2 client secret
|
||||
:form string token: access token to revoke
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400:
|
||||
- errors returned by Authlib library
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: errors returned by Authlib library
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
return authorization_server.create_endpoint_response('revocation')
|
||||
|
@ -91,7 +91,7 @@ def register_user() -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -102,7 +102,7 @@ def register_user() -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- error on registration
|
||||
- error on registration:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -121,21 +121,18 @@ def register_user() -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
fallback to 'en' (english))
|
||||
:<json boolean accepted_policy: ``true`` if user accepted privacy policy
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- sorry, that username is already taken
|
||||
- Errors:
|
||||
- username: 3 to 30 characters required
|
||||
- username:
|
||||
only alphanumeric characters and the underscore
|
||||
character "_" allowed
|
||||
- email: valid email must be provided
|
||||
- password: 8 characters required
|
||||
:statuscode 403:
|
||||
error, registration is disabled
|
||||
:statuscode 500:
|
||||
error, please try again or contact the administrator
|
||||
- ``invalid payload``
|
||||
- ``sorry, that username is already taken``
|
||||
- ``sorry, you must agree privacy policy to register``
|
||||
- ``username: 3 to 30 characters required``
|
||||
- ``username: only alphanumeric characters and the underscore
|
||||
character "_" allowed``
|
||||
- ``email: valid email must be provided``
|
||||
- ``password: 8 characters required``
|
||||
:statuscode 403: ``error, registration is disabled``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
if not current_app.config.get('is_registration_enabled'):
|
||||
return ForbiddenErrorResponse('error, registration is disabled')
|
||||
@ -204,7 +201,7 @@ def login_user() -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- successful login
|
||||
- successful login:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -232,10 +229,10 @@ def login_user() -> Union[Dict, HttpResponse]:
|
||||
:<json string email: user email
|
||||
:<json string password: password
|
||||
|
||||
:statuscode 200: successfully logged in
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 401: invalid credentials
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
:statuscode 200: ``successfully logged in``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401: ``invalid credentials``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
# get post data
|
||||
@ -373,11 +370,11 @@ def get_authenticated_user_profile(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success.
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
return {'status': 'success', 'data': auth_user.serialize(auth_user)}
|
||||
|
||||
@ -497,14 +494,13 @@ def edit_user(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: user profile updated
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
:statuscode 200: ``user profile updated``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
# get post data
|
||||
post_data = request.get_json()
|
||||
@ -668,19 +664,19 @@ def update_user_account(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: user account updated
|
||||
:statuscode 200: ``user account updated``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- email is missing
|
||||
- current password is missing
|
||||
- email: valid email must be provided
|
||||
- password: 8 characters required
|
||||
- ``invalid payload``
|
||||
- ``email is missing``
|
||||
- ``current password is missing``
|
||||
- ``email: valid email must be provided``
|
||||
- ``password: 8 characters required``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- invalid credentials
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
- ``invalid credentials``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
data = request.get_json()
|
||||
if not data:
|
||||
@ -901,15 +897,15 @@ def edit_user_preferences(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: user preferences updated
|
||||
:statuscode 200: ``user preferences updated``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- password: password and password confirmation don't match
|
||||
- ``invalid payload``
|
||||
- ``password: password and password confirmation don't match``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
# get post data
|
||||
post_data = request.get_json()
|
||||
@ -999,17 +995,16 @@ def edit_user_sport_preferences(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: user preferences updated
|
||||
:statuscode 200: ``user sport preferences updated``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- invalid hexadecimal color
|
||||
- ``invalid payload``
|
||||
- ``invalid hexadecimal color``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404:
|
||||
- sport does not exist
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``sport does not exist``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
post_data = request.get_json()
|
||||
if (
|
||||
@ -1094,12 +1089,11 @@ def reset_user_sport_preferences(
|
||||
|
||||
:statuscode 204: user preferences deleted
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404:
|
||||
- sport does not exist
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``sport does not exist``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
sport = Sport.query.filter_by(id=sport_id).first()
|
||||
if not sport:
|
||||
@ -1151,18 +1145,18 @@ def edit_picture(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: user picture updated
|
||||
:statuscode 200: ``user picture updated``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- no file part
|
||||
- no selected file
|
||||
- file extension not allowed
|
||||
- ``invalid payload``
|
||||
- ``no file part``
|
||||
- ``no selected file``
|
||||
- ``file extension not allowed``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 413: error during picture update: file size exceeds 1.0MB
|
||||
:statuscode 500: error during picture update
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 413: ``error during picture update: file size exceeds 1.0MB``
|
||||
:statuscode 500: ``error during picture update``
|
||||
"""
|
||||
try:
|
||||
response_object = get_error_response_if_file_is_invalid(
|
||||
@ -1235,10 +1229,10 @@ def del_picture(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
|
||||
:statuscode 204: picture deleted
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500: error during picture deletion
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error during picture deletion``
|
||||
|
||||
"""
|
||||
try:
|
||||
@ -1259,7 +1253,7 @@ def request_password_reset() -> Union[Dict, HttpResponse]:
|
||||
"""
|
||||
Handle password reset request.
|
||||
|
||||
If email sending is disabled, this endpoint is not available
|
||||
If email sending is disabled, this endpoint is not available.
|
||||
|
||||
**Example request**:
|
||||
|
||||
@ -1282,9 +1276,9 @@ def request_password_reset() -> Union[Dict, HttpResponse]:
|
||||
|
||||
:<json string email: user email
|
||||
|
||||
:statuscode 200: password reset request processed
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 404: the requested URL was not found on the server
|
||||
:statuscode 200: ``password reset request processed``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 404: ``the requested URL was not found on the server``
|
||||
|
||||
"""
|
||||
if not current_app.config['CAN_SEND_EMAILS']:
|
||||
@ -1353,10 +1347,10 @@ def update_password() -> Union[Dict, HttpResponse]:
|
||||
:<json string password: password (8 characters required)
|
||||
:<json string token: password reset token
|
||||
|
||||
:statuscode 200: password updated
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 401: invalid token, please request a new token
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
:statuscode 200: ``password updated``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401: ``invalid token, please request a new token``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
post_data = request.get_json()
|
||||
@ -1433,9 +1427,9 @@ def update_email() -> Union[Dict, HttpResponse]:
|
||||
|
||||
:<json string token: password reset token
|
||||
|
||||
:statuscode 200: email updated
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
:statuscode 200: ``email updated``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
post_data = request.get_json()
|
||||
@ -1493,9 +1487,9 @@ def confirm_account() -> Union[Dict, HttpResponse]:
|
||||
|
||||
:<json string token: confirmation token
|
||||
|
||||
:statuscode 200: account confirmation successful
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
:statuscode 200: ``account confirmation successful``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
post_data = request.get_json()
|
||||
@ -1556,10 +1550,10 @@ def resend_account_confirmation_email() -> Union[Dict, HttpResponse]:
|
||||
|
||||
:<json string email: user email
|
||||
|
||||
:statuscode 200: confirmation email resent
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 404: the requested URL was not found on the server
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
:statuscode 200: ``confirmation email resent``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 404: ``the requested URL was not found on the server``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
if not current_app.config['CAN_SEND_EMAILS']:
|
||||
@ -1603,7 +1597,7 @@ def logout_user(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- successful logout
|
||||
- successful logout:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -1615,7 +1609,7 @@ def logout_user(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- error on logout
|
||||
- error on logout:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -1629,13 +1623,12 @@ def logout_user(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: successfully logged out
|
||||
:statuscode 200: ``successfully logged out``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- The access token provided is expired, revoked, malformed, or invalid
|
||||
for other reasons.
|
||||
:statuscode 500:
|
||||
- error on token blacklist
|
||||
- ``provide a valid auth token``
|
||||
- ``The access token provided is expired, revoked, malformed, or invalid
|
||||
for other reasons.``
|
||||
:statuscode 500: ``error on token blacklist``
|
||||
|
||||
"""
|
||||
auth_token = request.headers.get('Authorization', '').split(' ')[1]
|
||||
@ -1682,14 +1675,13 @@ def accept_privacy_policy(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500: internal server error
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
post_data = request.get_json()
|
||||
if not post_data or not post_data.get('accepted_policy'):
|
||||
@ -1738,15 +1730,15 @@ def request_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400:
|
||||
- ongoing request exists
|
||||
- completed request already exists
|
||||
- ``ongoing request exists``
|
||||
- ``completed request already exists``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500: internal server error
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
existing_export_request = UserDataExport.query.filter_by(
|
||||
user_id=auth_user.id
|
||||
@ -1800,7 +1792,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example response**:
|
||||
|
||||
- if a request exists
|
||||
- if a request exists:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -1817,7 +1809,7 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
}
|
||||
}
|
||||
|
||||
- if no request
|
||||
- if no request:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -1831,11 +1823,11 @@ def get_user_data_export(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
"""
|
||||
export_request = UserDataExport.query.filter_by(
|
||||
user_id=auth_user.id
|
||||
@ -1874,12 +1866,12 @@ def download_data_export(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: file not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``file not found``
|
||||
"""
|
||||
export_request = UserDataExport.query.filter_by(
|
||||
user_id=auth_user.id
|
||||
|
@ -47,14 +47,14 @@ def get_users(auth_user: User) -> Dict:
|
||||
|
||||
**Example request**:
|
||||
|
||||
- without parameters
|
||||
- without parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/users HTTP/1.1
|
||||
Content-Type: application/json
|
||||
|
||||
- with some query parameters
|
||||
- with some query parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -180,11 +180,11 @@ def get_users(auth_user: User) -> Dict:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
|
||||
"""
|
||||
params = request.args.copy()
|
||||
@ -325,13 +325,13 @@ def get_single_user(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
- ``user does not exist``
|
||||
"""
|
||||
if user_name != auth_user.username and not auth_user.admin:
|
||||
return ForbiddenErrorResponse()
|
||||
@ -369,10 +369,10 @@ def get_picture(user_name: str) -> Any:
|
||||
|
||||
:param integer user_name: user name
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
- No picture.
|
||||
- ``user does not exist``
|
||||
- ``No picture.``
|
||||
|
||||
"""
|
||||
try:
|
||||
@ -504,19 +504,18 @@ def update_user(auth_user: User, user_name: str) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- valid email must be provided
|
||||
- new email must be different than curent email
|
||||
- ``invalid payload``
|
||||
- ``valid email must be provided``
|
||||
- ``new email must be different than curent email``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 403: you do not have permissions
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 403: ``you do not have permissions``
|
||||
:statuscode 404: ``user does not exist``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
"""
|
||||
user_data = request.get_json()
|
||||
if not user_data:
|
||||
@ -632,15 +631,14 @@ def delete_user(
|
||||
|
||||
:statuscode 204: user account deleted
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 403:
|
||||
- you do not have permissions
|
||||
- you can not delete your account, no other user has admin rights
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``you do not have permissions``
|
||||
- ``you can not delete your account, no other user has admin rights``
|
||||
:statuscode 404: ``user does not exist``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
try:
|
||||
|
@ -110,11 +110,11 @@ def get_records(auth_user: User) -> Dict:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
|
||||
"""
|
||||
records = (
|
||||
|
@ -35,7 +35,7 @@ def get_sports(auth_user: User) -> Dict:
|
||||
|
||||
**Example response**:
|
||||
|
||||
- for non admin user :
|
||||
- for non admin user:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -98,7 +98,7 @@ def get_sports(auth_user: User) -> Dict:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- for admin user :
|
||||
- for admin user:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -169,11 +169,11 @@ def get_sports(auth_user: User) -> Dict:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
|
||||
"""
|
||||
sports = Sport.query.order_by(Sport.id).all()
|
||||
@ -213,7 +213,7 @@ def get_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example response**:
|
||||
|
||||
- success for non admin user :
|
||||
- success for non admin user:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -236,7 +236,7 @@ def get_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- success for admin user :
|
||||
- success for admin user:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -260,7 +260,7 @@ def get_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- sport not found
|
||||
- sport not found:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -278,12 +278,12 @@ def get_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: sport not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``sport not found``
|
||||
|
||||
"""
|
||||
sport = Sport.query.filter_by(id=sport_id).first()
|
||||
@ -326,7 +326,7 @@ def update_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -350,7 +350,7 @@ def update_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- sport not found
|
||||
- sport not found:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -371,14 +371,14 @@ def update_sport(auth_user: User, sport_id: int) -> Union[Dict, HttpResponse]:
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: sport updated
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 403: you do not have permissions
|
||||
:statuscode 404: sport not found
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 403: ``you do not have permissions``
|
||||
:statuscode 404: ``sport not found``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
sport_data = request.get_json()
|
||||
|
@ -185,13 +185,13 @@ def get_workouts_by_time(
|
||||
|
||||
**Example requests**:
|
||||
|
||||
- without parameters
|
||||
- without parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/stats/admin/by_time HTTP/1.1
|
||||
|
||||
- with parameters
|
||||
- with parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -200,7 +200,7 @@ def get_workouts_by_time(
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -243,7 +243,7 @@ def get_workouts_by_time(
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- no workouts
|
||||
- no workouts:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -270,13 +270,12 @@ def get_workouts_by_time(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``user does not exist``
|
||||
|
||||
"""
|
||||
return get_workouts(user_name, 'by_time')
|
||||
@ -294,13 +293,13 @@ def get_workouts_by_sport(
|
||||
|
||||
**Example requests**:
|
||||
|
||||
- without parameters (get stats for all sports with workouts)
|
||||
- without parameters (get stats for all sports with workouts):
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/stats/admin/by_sport HTTP/1.1
|
||||
|
||||
- with sport id
|
||||
- with sport id:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -308,7 +307,7 @@ def get_workouts_by_sport(
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -347,7 +346,7 @@ def get_workouts_by_sport(
|
||||
"status": "success"
|
||||
}
|
||||
|
||||
- no workouts
|
||||
- no workouts:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -367,14 +366,14 @@ def get_workouts_by_sport(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404:
|
||||
- user does not exist
|
||||
- sport does not exist
|
||||
- ``user does not exist``
|
||||
- ``sport does not exist``
|
||||
|
||||
"""
|
||||
return get_workouts(user_name, 'by_sport')
|
||||
@ -414,12 +413,12 @@ def get_application_stats(auth_user: User) -> Dict:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 403: you do not have permissions
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 403: ``you do not have permissions``
|
||||
"""
|
||||
|
||||
nb_workouts = Workout.query.filter().count()
|
||||
|
@ -65,13 +65,13 @@ def get_workouts(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example requests**:
|
||||
|
||||
- without parameters
|
||||
- without parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
GET /api/workouts/ HTTP/1.1
|
||||
|
||||
- with some query parameters
|
||||
- with some query parameters:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -79,7 +79,7 @@ def get_workouts(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- returning at least one workout
|
||||
- returning at least one workout:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -187,7 +187,7 @@ def get_workouts(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
:query integer per_page: number of workouts per page
|
||||
(default: 5, max: 100)
|
||||
:query integer sport_id: sport id
|
||||
:quert string title: any part (or all) of the workout title;
|
||||
:query string title: any part (or all) of the workout title;
|
||||
title matching is case-insensitive
|
||||
:query string from: start date (format: ``%Y-%m-%d``)
|
||||
:query string to: end date (format: ``%Y-%m-%d``)
|
||||
@ -206,12 +206,12 @@ def get_workouts(auth_user: User) -> Union[Dict, HttpResponse]:
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
try:
|
||||
@ -315,7 +315,7 @@ def get_workout(
|
||||
|
||||
**Example responses**:
|
||||
|
||||
- success
|
||||
- success:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
@ -377,13 +377,13 @@ def get_workout(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 403: you do not have permissions
|
||||
:statuscode 404: workout not found
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 403: ``you do not have permissions``
|
||||
:statuscode 404: ``workout not found``
|
||||
|
||||
"""
|
||||
workout_uuid = decode_short_id(workout_short_id)
|
||||
@ -499,15 +499,15 @@ def get_workout_gpx(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404:
|
||||
- workout not found
|
||||
- no gpx file for this workout
|
||||
:statuscode 500:
|
||||
- ``workout not found``
|
||||
- ``no gpx file for this workout``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
return get_workout_data(auth_user, workout_short_id, 'gpx')
|
||||
@ -570,15 +570,15 @@ def get_workout_chart_data(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404:
|
||||
- workout not found
|
||||
- no gpx file for this workout
|
||||
:statuscode 500:
|
||||
- ``workout not found``
|
||||
- ``no gpx file for this workout``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
return get_workout_data(auth_user, workout_short_id, 'chart_data')
|
||||
@ -624,14 +624,14 @@ def get_segment_gpx(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400: no gpx file for this workout
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: ``no gpx file for this workout``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: workout not found
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``workout not found``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
return get_workout_data(auth_user, workout_short_id, 'gpx', segment_id)
|
||||
@ -647,7 +647,7 @@ def get_segment_chart_data(
|
||||
auth_user: User, workout_short_id: str, segment_id: int
|
||||
) -> Union[Dict, HttpResponse]:
|
||||
"""
|
||||
Get chart data from a workout gpx file, to display it with Recharts
|
||||
Get chart data from a workout gpx file, to display it with Chart.js.
|
||||
|
||||
**Scope**: ``workouts:read``
|
||||
|
||||
@ -697,14 +697,14 @@ def get_segment_chart_data(
|
||||
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 400: no gpx file for this workout
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 400: ``no gpx file for this workout``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: workout not found
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``workout not found``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
return get_workout_data(
|
||||
@ -739,14 +739,14 @@ def download_workout_gpx(
|
||||
|
||||
:param string workout_short_id: workout short id
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404:
|
||||
- workout not found
|
||||
- no gpx file for workout
|
||||
- ``workout not found``
|
||||
- ``no gpx file for workout``
|
||||
"""
|
||||
workout_uuid = decode_short_id(workout_short_id)
|
||||
workout = Workout.query.filter_by(
|
||||
@ -794,13 +794,13 @@ def get_map(map_id: int) -> Union[HttpResponse, Response]:
|
||||
|
||||
:param string map_id: workout map id
|
||||
|
||||
:statuscode 200: success
|
||||
:statuscode 200: ``success``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: map does not exist
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``map does not exist``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
try:
|
||||
@ -967,16 +967,16 @@ def post_workout(auth_user: User) -> Union[Tuple[Dict, int], HttpResponse]:
|
||||
|
||||
:statuscode 201: workout created
|
||||
:statuscode 400:
|
||||
- invalid payload
|
||||
- no file part
|
||||
- no selected file
|
||||
- file extension not allowed
|
||||
- ``invalid payload``
|
||||
- ``no file part``
|
||||
- ``no selected file``
|
||||
- ``file extension not allowed``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 413: error during picture update: file size exceeds 1.0MB
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 413: ``error during picture update: file size exceeds 1.0MB``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
try:
|
||||
@ -1151,12 +1151,12 @@ def post_workout_no_gpx(
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 201: workout created
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
workout_data = request.get_json()
|
||||
@ -1325,13 +1325,13 @@ def update_workout(
|
||||
:reqheader Authorization: OAuth 2.0 Bearer Token
|
||||
|
||||
:statuscode 200: workout updated
|
||||
:statuscode 400: invalid payload
|
||||
:statuscode 400: ``invalid payload``
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: workout not found
|
||||
:statuscode 500:
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``workout not found``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
workout_data = request.get_json()
|
||||
@ -1418,11 +1418,11 @@ def delete_workout(
|
||||
|
||||
:statuscode 204: workout deleted
|
||||
:statuscode 401:
|
||||
- provide a valid auth token
|
||||
- signature expired, please log in again
|
||||
- invalid token, please log in again
|
||||
:statuscode 404: workout not found
|
||||
:statuscode 500: error, please try again or contact the administrator
|
||||
- ``provide a valid auth token``
|
||||
- ``signature expired, please log in again``
|
||||
- ``invalid token, please log in again``
|
||||
:statuscode 404: ``workout not found``
|
||||
:statuscode 500: ``error, please try again or contact the administrator``
|
||||
|
||||
"""
|
||||
|
||||
|
Reference in New Issue
Block a user