@@ -21,7 +21,7 @@ def __init__(self, base_url, session=None):
21
21
22
22
def valid_authentication (self , auth ):
23
23
"""
24
- Returns whether the provided authentication is valid
24
+ Returns whether ``auth`` is valid
25
25
26
26
:param auth.Authentication auth: authentication object
27
27
:return: whether the provided authentication is valid
@@ -32,11 +32,11 @@ def valid_authentication(self, auth):
32
32
33
33
def authenticated_user (self , auth ):
34
34
"""
35
- Returns the user authenticated by the given authentication
35
+ Returns the user authenticated by ``auth``
36
36
37
37
:param auth.Authentication auth: authentication for user to retrieve
38
38
39
- :return: user corresponding to the provided authentication
39
+ :return: user authenticated by the provided authentication
40
40
:rtype: GogsUser
41
41
:raises NetworkFailure: if there is an error communicating with the server
42
42
:raises ApiFailure: if the request cannot be serviced
@@ -46,14 +46,15 @@ def authenticated_user(self, auth):
46
46
47
47
def get_tokens (self , auth , username = None ):
48
48
"""
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``.
52
51
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
54
55
:param str username: username of owner of tokens
55
56
56
- :return: list of token representation
57
+ :return: list of tokens
57
58
:rtype: List[Token]
58
59
:raises NetworkFailure: if there is an error communicating with the server
59
60
:raises ApiFailure: if the request cannot be serviced
@@ -65,11 +66,12 @@ def get_tokens(self, auth, username=None):
65
66
66
67
def create_token (self , auth , name , username = None ):
67
68
"""
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``.
71
71
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
73
75
:param str name: name of new token
74
76
:param str username: username of owner of new token
75
77
@@ -86,11 +88,13 @@ def create_token(self, auth, name, username=None):
86
88
87
89
def ensure_token (self , auth , name , username = None ):
88
90
"""
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`` .
92
94
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
94
98
:param str name: name of new token
95
99
:param str username: username of owner of new token
96
100
0 commit comments