Updated README.md with a new layout
Fixed name of function to better fit the standard (addClient -> createClient)
This commit is contained in:
parent
726446cff9
commit
01fdbc4d31
205
README.md
205
README.md
@ -6,7 +6,7 @@ Initialize the wrapper with the token you want to use
|
|||||||
|
|
||||||
i.e: gotipy_usr = gotipy.gotipy("user token", "https://URL.TLD")
|
i.e: gotipy_usr = gotipy.gotipy("user token", "https://URL.TLD")
|
||||||
|
|
||||||
<b>applications class</b>
|
<h3><b>applications class</b></h3>
|
||||||
<table style="width:100%">
|
<table style="width:100%">
|
||||||
<tr>
|
<tr>
|
||||||
<th>Function</th>
|
<th>Function</th>
|
||||||
@ -20,7 +20,7 @@ i.e: gotipy_usr = gotipy.gotipy("user token", "https://URL.TLD")
|
|||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td>createApplication</td>
|
<td>createApplication</td>
|
||||||
<td>name, description</td>
|
<td>Name, Description</td>
|
||||||
<td>JSON formatted list</td>
|
<td>JSON formatted list</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
@ -35,73 +35,142 @@ i.e: gotipy_usr = gotipy.gotipy("user token", "https://URL.TLD")
|
|||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<h3>Functions Implimented</h3> <b/>
|
<h3><b>clients class</b></h3>
|
||||||
|
<table style="width:100%">
|
||||||
|
<tr>
|
||||||
|
<th>Function</th>
|
||||||
|
<th>Arguments</th>
|
||||||
|
<th>Return</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getClients</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>createClient</td>
|
||||||
|
<td>Name</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>deleteClient</td>
|
||||||
|
<td>Client ID</td>
|
||||||
|
<td>HTTP response code</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
- basicAuth(user, passwd)
|
<h3><b>msgManager class</b></h3>
|
||||||
Sets up basic Auth for inclusion in the header
|
<table style="width:100%">
|
||||||
|
<tr>
|
||||||
|
<th>Function</th>
|
||||||
|
<th>Arguments</th>
|
||||||
|
<th>Return</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getMessagesByApp</td>
|
||||||
|
<td>Application ID</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>deleteAllMessagesFromApp</td>
|
||||||
|
<td>Application ID</td>
|
||||||
|
<td>HTTP response code</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getAllMesages</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>deleteAllMessages</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>HTTP response code</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>deleteMessagesByID</td>
|
||||||
|
<td>Message ID</td>
|
||||||
|
<td>HTTP response code</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getStream</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
- getApplications()
|
<h3><b>messages class</b></h3>
|
||||||
Returns a JSON formatted list of applications
|
<table style="width:100%">
|
||||||
|
<tr>
|
||||||
|
<th>Function</th>
|
||||||
|
<th>Arguments</th>
|
||||||
|
<th>Return</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>sendMessage</td>
|
||||||
|
<td>Title, Message</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
- createApplication(name, description)
|
<h3><b>users class</b></h3>
|
||||||
Creates an application with defined name and description
|
<table style="width:100%">
|
||||||
|
<tr>
|
||||||
|
<th>Function</th>
|
||||||
|
<th>Arguments</th>
|
||||||
|
<th>Return</th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getCurrentUser()</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>changeUserPassword</td>
|
||||||
|
<td>Password</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getUsers</td>
|
||||||
|
<td>N/A</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>createUser</td>
|
||||||
|
<td>Admin, Username, Password</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>getUserByID</td>
|
||||||
|
<td>User ID</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>updateUserByID</td>
|
||||||
|
<td>User ID, Admin, Username, Password</td>
|
||||||
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>deleteUserByID</td>
|
||||||
|
<td>User ID</td>
|
||||||
|
<td>HTTP response code</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
|
||||||
- deleteApplication(appid)
|
<h3><b>utils class</b></h3>
|
||||||
Delete Application via appid
|
<table style="width:100%">
|
||||||
|
<tr>
|
||||||
- updateApplicationImage(appid, imgData)
|
<th>Function</th>
|
||||||
Updates the application image
|
<th>Arguments</th>
|
||||||
|
<th>Return</th>
|
||||||
- getClients()
|
</tr>
|
||||||
Returns a JSON formatted list of Clients
|
<tr>
|
||||||
|
<td>getVersion</td>
|
||||||
- addClient(name)
|
<td>N/A</td>
|
||||||
Creates a new client with name
|
<td>JSON formatted list</td>
|
||||||
|
</tr>
|
||||||
- deleteClient(clientid)
|
<tr>
|
||||||
Delete clients via clientID
|
<td>basicAuth</td>
|
||||||
|
<td>Username, password</td>
|
||||||
- getMessagesByApp(appid)
|
<td>JSON formatted list</td>
|
||||||
Returns a JSON formatted list of messages in an application
|
</tr>
|
||||||
|
</table>
|
||||||
- deleteAllMessagesFromApp(appid)
|
|
||||||
Deletes all messages in an application
|
|
||||||
|
|
||||||
- getAllMessages()
|
|
||||||
Returns a JSON formatted list of all messages
|
|
||||||
|
|
||||||
- sendMessage(title, message)
|
|
||||||
Sends a message using an application auth token (Note this is the only function that requires an application token)
|
|
||||||
|
|
||||||
- deleteAllMessages()
|
|
||||||
Deletes all messages
|
|
||||||
|
|
||||||
- deleteMessageByID(msgid)
|
|
||||||
Delete a message by its ID
|
|
||||||
|
|
||||||
- getStream() ## Currently broken, returns 400 error, no idea why
|
|
||||||
This should return all new messages but it doesn't, also broken when testing with the docs so #nfi
|
|
||||||
|
|
||||||
- getCurrentUser()
|
|
||||||
Returns a JSON formatted list of information for the current user
|
|
||||||
|
|
||||||
- changeUserPassword(passwd)
|
|
||||||
Changes the password of the current account
|
|
||||||
|
|
||||||
- getUsers()
|
|
||||||
Returns a JSON formatted list of users
|
|
||||||
|
|
||||||
- createUser(isAdmin, username, password)
|
|
||||||
Creates a new user with the specified details (isAdmin: boolean value)
|
|
||||||
|
|
||||||
- getUserByID(userID)
|
|
||||||
Returns a JSON formatted list of the selected user
|
|
||||||
|
|
||||||
- updateUserByID(userID, isAdmin, username, password) ## I really do not like this implementation will look into a better way
|
|
||||||
Updates the user information by ID, need to pass an entire user data object currently, working on a better way
|
|
||||||
|
|
||||||
- deleteUserByID(userID)
|
|
||||||
Deletes user by ID
|
|
||||||
|
|
||||||
- getVersion()
|
|
||||||
Returns the version of gotify running on the server
|
|
||||||
@ -62,7 +62,7 @@ class gotipy(object):
|
|||||||
req = requests.get(self.requrl, headers=self.headers)
|
req = requests.get(self.requrl, headers=self.headers)
|
||||||
return req
|
return req
|
||||||
|
|
||||||
def addClient(self, name):
|
def createClient(self, name):
|
||||||
self.name = name
|
self.name = name
|
||||||
self.requrl = self.url + '/client'
|
self.requrl = self.url + '/client'
|
||||||
data = {"name": self.name}
|
data = {"name": self.name}
|
||||||
@ -71,7 +71,6 @@ class gotipy(object):
|
|||||||
req = requests.post(self.requrl, headers=self.headers, json=data)
|
req = requests.post(self.requrl, headers=self.headers, json=data)
|
||||||
return req
|
return req
|
||||||
|
|
||||||
def deleteClient(self, clientid):
|
|
||||||
self.clientid = clientid
|
self.clientid = clientid
|
||||||
self.requrl = self.url + '/client/' + str(self.clientid)
|
self.requrl = self.url + '/client/' + str(self.clientid)
|
||||||
|
|
||||||
@ -235,4 +234,4 @@ class gotipy(object):
|
|||||||
print(self.string.encode('utf-8'))
|
print(self.string.encode('utf-8'))
|
||||||
self.headers["authorization"] = "Basic " + base64.b64encode(self.string)
|
self.headers["authorization"] = "Basic " + base64.b64encode(self.string)
|
||||||
print(self.encoded)
|
print(self.encoded)
|
||||||
return self.headers
|
return self.headers
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user