Mercurial > kallithea
changeset 8935:ba64339f7937 stable
api docs: make examples more like 4 space indented
author | Mads Kiilerich <mads@kiilerich.com> |
---|---|
date | Fri, 14 Oct 2022 14:02:15 +0200 |
parents | 6f9dec2295dc |
children | ac5525c48f0a |
files | docs/api/api.rst kallithea/controllers/api/api.py |
diffstat | 2 files changed, 166 insertions(+), 166 deletions(-) [+] |
line wrap: on
line diff
--- a/docs/api/api.rst Wed Jan 06 01:08:12 2021 +0100 +++ b/docs/api/api.rst Fri Oct 14 14:02:15 2022 +0200 @@ -575,16 +575,16 @@ "description" : "<description>", "landing_rev": "<landing_rev>", "last_changeset": { - "author": "<full_author>", - "date": "<date_time_of_commit>", - "message": "<commit_message>", - "raw_id": "<raw_id>", - "revision": "<numeric_revision>", - "short_id": "<short_id>" + "author": "<full_author>", + "date": "<date_time_of_commit>", + "message": "<commit_message>", + "raw_id": "<raw_id>", + "revision": "<numeric_revision>", + "short_id": "<short_id>" }, "owner": "<repo_owner>", "fork_of": "<name_of_fork_parent>", - "members" : [ + "members" : [ { "type": "user", "user_id" : "<user_id>", @@ -609,8 +609,8 @@ "permission" : "repository.(read|write|admin)" }, … - ], - "followers": [ + ], + "followers": [ { "user_id" : "<user_id>", "username" : "<username>", @@ -626,20 +626,20 @@ "last_login": "<last_login>", }, … - ], - <if with_revision_names == True> - "tags": { + ], + <if with_revision_names == True> + "tags": { "<tagname>": "<raw_id>", ... - }, - "branches": { + }, + "branches": { "<branchname>": "<raw_id>", ... - }, - "bookmarks": { + }, + "bookmarks": { "<bookmarkname>": "<raw_id>", ... - }, + }, <if with_pullrequests == True> "pull_requests": [ {
--- a/kallithea/controllers/api/api.py Wed Jan 06 01:08:12 2021 +0100 +++ b/kallithea/controllers/api/api.py Fri Oct 14 14:02:15 2022 +0200 @@ -172,20 +172,20 @@ OUTPUT:: - id : <id_given_in_input> - result : { - "msg": "Pulled from `<repository name>`" - "repository": "<repository name>" - } - error : null + id : <id_given_in_input> + result : { + "msg": "Pulled from `<repository name>`" + "repository": "<repository name>" + } + error : null ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "Unable to pull changes from `<reponame>`" - } + id : <id_given_in_input> + result : null + error : { + "Unable to pull changes from `<reponame>`" + } """ repo = get_repo_or_error(repoid) @@ -218,20 +218,20 @@ OUTPUT:: - id : <id_given_in_input> - result : { - 'added': [<added repository name>,...] - 'removed': [<removed repository name>,...] - } - error : null + id : <id_given_in_input> + result : { + 'added': [<added repository name>,...] + 'removed': [<removed repository name>,...] + } + error : null ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - 'Error occurred during rescan repositories action' - } + id : <id_given_in_input> + result : null + error : { + 'Error occurred during rescan repositories action' + } """ try: rm_obsolete = remove_obsolete @@ -255,20 +255,20 @@ OUTPUT:: - id : <id_given_in_input> - result : { - 'msg': Cache for repository `<repository name>` was invalidated, - 'repository': <repository name> - } - error : null + id : <id_given_in_input> + result : { + 'msg': Cache for repository `<repository name>` was invalidated, + 'repository': <repository name> + } + error : null ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - 'Error occurred during cache invalidation action' - } + id : <id_given_in_input> + result : null + error : { + 'Error occurred during cache invalidation action' + } """ repo = get_repo_or_error(repoid) if not HasPermissionAny('hg.admin')(): @@ -333,16 +333,16 @@ OUTPUT:: - id : <id_given_in_input> - result : { - 'modules': [ [<module name>, <module version>], ...] - 'py_version': <python version>, - 'platform': <platform type>, - 'kallithea_version': <kallithea version>, - 'git_version': '<git version>', - 'git_path': '<git path>' - } - error : null + id : <id_given_in_input> + result : { + 'modules': [ [<module name>, <module version>], ...] + 'py_version': <python version>, + 'platform': <platform type>, + 'kallithea_version': <kallithea version>, + 'git_version': '<git version>', + 'git_path': '<git path>' + } + error : null """ return db.Setting.get_server_info() @@ -456,15 +456,15 @@ ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "user `<username>` already exist" - or - "email `<email>` already exist" - or - "failed to create user `<username>`" - } + id : <id_given_in_input> + result : null + error : { + "user `<username>` already exist" + or + "email `<email>` already exist" + or + "failed to create user `<username>`" + } """ if db.User.get_by_username(username): raise JSONRPCError("user `%s` already exist" % (username,)) @@ -535,11 +535,11 @@ ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "failed to update user `<username>`" - } + id : <id_given_in_input> + result : null + error : { + "failed to update user `<username>`" + } """ user = get_user_or_error(userid) @@ -591,11 +591,11 @@ ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "failed to delete user ID:<userid> <username>" - } + id : <id_given_in_input> + result : null + error : { + "failed to delete user ID:<userid> <username>" + } """ user = get_user_or_error(userid) @@ -690,13 +690,13 @@ ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "user group `<group name>` already exist" - or - "failed to create group `<group name>`" - } + id : <id_given_in_input> + result : null + error : { + "user group `<group name>` already exist" + or + "failed to create group `<group name>`" + } """ if UserGroupModel().get_by_name(group_name): raise JSONRPCError("user group `%s` already exist" % (group_name,)) @@ -843,21 +843,21 @@ OUTPUT:: - id : <id_given_in_input> - result : { - "success": True|False # depends on if member is in group - "msg": "added member `<username>` to a user group `<groupname>` | - User is already in that group" - } - error : null + id : <id_given_in_input> + result : { + "success": True|False # depends on if member is in group + "msg": "added member `<username>` to a user group `<groupname>` | + User is already in that group" + } + error : null ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "failed to add member to user group `<user_group_name>`" - } + id : <id_given_in_input> + result : null + error : { + "failed to add member to user group `<user_group_name>`" + } """ user = get_user_or_error(userid) user_group = get_user_group_or_error(usergroupid) @@ -943,58 +943,58 @@ OUTPUT:: - id : <id_given_in_input> - result : { - "repo_id" : "<repo_id>", - "repo_name" : "<reponame>" - "repo_type" : "<repo_type>", - "clone_uri" : "<clone_uri>", - "enable_downloads": "<bool>", - "enable_statistics": "<bool>", - "private": "<bool>", - "created_on" : "<date_time_created>", - "description" : "<description>", - "landing_rev": "<landing_rev>", - "last_changeset": { - "author": "<full_author>", - "date": "<date_time_of_commit>", - "message": "<commit_message>", - "raw_id": "<raw_id>", - "revision": "<numeric_revision>", - "short_id": "<short_id>" - } - "owner": "<repo_owner>", - "fork_of": "<name_of_fork_parent>", - "members" : [ - { - "name": "<username>", - "type" : "user", - "permission" : "repository.(read|write|admin)" - }, - … - { - "name": "<usergroup name>", - "type" : "user_group", - "permission" : "usergroup.(read|write|admin)" - }, - … - ] - "followers": [<user_obj>, ...], - <if with_revision_names == True> - "tags": { - "<tagname>": "<raw_id>", - ... - }, - "branches": { - "<branchname>": "<raw_id>", - ... - }, - "bookmarks": { - "<bookmarkname>": "<raw_id>", - ... - }, - } - error : null + id : <id_given_in_input> + result : { + "repo_id" : "<repo_id>", + "repo_name" : "<reponame>" + "repo_type" : "<repo_type>", + "clone_uri" : "<clone_uri>", + "enable_downloads": "<bool>", + "enable_statistics": "<bool>", + "private": "<bool>", + "created_on" : "<date_time_created>", + "description" : "<description>", + "landing_rev": "<landing_rev>", + "last_changeset": { + "author": "<full_author>", + "date": "<date_time_of_commit>", + "message": "<commit_message>", + "raw_id": "<raw_id>", + "revision": "<numeric_revision>", + "short_id": "<short_id>" + } + "owner": "<repo_owner>", + "fork_of": "<name_of_fork_parent>", + "members" : [ + { + "name": "<username>", + "type" : "user", + "permission" : "repository.(read|write|admin)" + }, + … + { + "name": "<usergroup name>", + "type" : "user_group", + "permission" : "usergroup.(read|write|admin)" + }, + … + ] + "followers": [<user_obj>, ...], + <if with_revision_names == True> + "tags": { + "<tagname>": "<raw_id>", + ... + }, + "branches": { + "<branchname>": "<raw_id>", + ... + }, + "bookmarks": { + "<bookmarkname>": "<raw_id>", + ... + }, + } + error : null """ repo = get_repo_or_error(repoid) @@ -1177,11 +1177,11 @@ ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - 'failed to create repository `<repo_name>` - } + id : <id_given_in_input> + result : null + error : { + 'failed to create repository `<repo_name>` + } """ group_name = None repo_name_parts = repo_name.split('/') @@ -1579,20 +1579,20 @@ OUTPUT:: - id : <id_given_in_input> - result : { - "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", - "success": true - } - error : null + id : <id_given_in_input> + result : { + "msg" : "Granted perm: `<perm>` for group: `<usersgroupname>` in repo: `<reponame>`", + "success": true + } + error : null ERROR OUTPUT:: - id : <id_given_in_input> - result : null - error : { - "failed to edit permission for user group: `<usergroup>` in repo `<repo>`' - } + id : <id_given_in_input> + result : null + error : { + "failed to edit permission for user group: `<usergroup>` in repo `<repo>`' + } """ repo = get_repo_or_error(repoid) perm = get_perm_or_error(perm)