@@ -21,7 +21,7 @@ def __init__(self, base_url, session=None):
2121
2222 def valid_authentication (self , auth ):
2323 """
24- Returns whether the provided authentication is valid
24+ Returns whether ``auth`` is valid
2525
2626 :param auth.Authentication auth: authentication object
2727 :return: whether the provided authentication is valid
@@ -32,11 +32,11 @@ def valid_authentication(self, auth):
3232
3333 def authenticated_user (self , auth ):
3434 """
35- Returns the user authenticated by the given authentication
35+ Returns the user authenticated by ``auth``
3636
3737 :param auth.Authentication auth: authentication for user to retrieve
3838
39- :return: user corresponding to the provided authentication
39+ :return: user authenticated by the provided authentication
4040 :rtype: GogsUser
4141 :raises NetworkFailure: if there is an error communicating with the server
4242 :raises ApiFailure: if the request cannot be serviced
@@ -46,14 +46,15 @@ def authenticated_user(self, auth):
4646
4747 def get_tokens (self , auth , username = None ):
4848 """
49- Returns tokens defined for specified user.
50- If no user specified uses user authenticated by the given authentication.
51- Right now, authentication must be UsernamePassword (not Token).
49+ Returns the tokens owned by the specified user. If no user is specified,
50+ uses the user authenticated by ``auth``.
5251
53- :param auth.Authentication auth: authentication for user to retrieve
52+ :param auth.Authentication auth: authentication for user to retrieve.
53+ Must be a username-password authentication, due to a restriction of the
54+ Gogs API
5455 :param str username: username of owner of tokens
5556
56- :return: list of token representation
57+ :return: list of tokens
5758 :rtype: List[Token]
5859 :raises NetworkFailure: if there is an error communicating with the server
5960 :raises ApiFailure: if the request cannot be serviced
@@ -65,11 +66,12 @@ def get_tokens(self, auth, username=None):
6566
6667 def create_token (self , auth , name , username = None ):
6768 """
68- Creates new token with specified name for specified user.
69- If no user specified uses user authenticated by the given authentication.
70- Right now, authentication must be UsernamePassword (not Token).
69+ Creates a new token with the specified name for the specified user.
70+ If no user is specified, uses user authenticated by ``auth``.
7171
72- :param auth.Authentication auth: authentication for user to retrieve
72+ :param auth.Authentication auth: authentication for user to retrieve.
73+ Must be a username-password authentication, due to a restriction of the
74+ Gogs API
7375 :param str name: name of new token
7476 :param str username: username of owner of new token
7577
@@ -86,11 +88,13 @@ def create_token(self, auth, name, username=None):
8688
8789 def ensure_token (self , auth , name , username = None ):
8890 """
89- Creates new token if token with specified name for specified user does not exists.
90- If no user specified uses user authenticated by the given authentication.
91- Right now, authentication must be UsernamePassword (not Token) .
91+ Ensures the existence of a token with the specified name for the
92+ specified user. Creates a new token if none exists. If no user is
93+ specified, uses user authenticated by ``auth`` .
9294
93- :param auth.Authentication auth: authentication for user to retrieve
95+ :param auth.Authentication auth: authentication for user to retrieve.
96+ Must be a username-password authentication, due to a restriction of the
97+ Gogs API
9498 :param str name: name of new token
9599 :param str username: username of owner of new token
96100
0 commit comments