gotipy/README.md
2018-11-11 20:09:19 +11:00

107 lines
2.7 KiB
Markdown

<h2>API Wrapper for gotify RESTAPI for python3</h2>
<b><a href="https://github.com/gotify/server"> Gotify server</a></b>
Initialize the wrapper with the token you want to use
i.e: gotipy_usr = gotipy.gotipy("user token", "https://URL.TLD")
<b>applications class</b>
<table style="width:100%">
<tr>
<th>Function</th>
<th>Arguments</th>
<th>Return</th>
</tr>
<tr>
<td>getApplications</td>
<td>N/A</td>
<td>JSON formatted list</td>
</tr>
<tr>
<td>createApplication</td>
<td>name, description</td>
<td>JSON formatted list</td>
</tr>
<tr>
<td>deleteApplication</td>
<td>Application ID</td>
<td>HTTP resopnse code</td>
</tr>
<tr>
<td>updateApplicationImage</td>
<td>Application ID, Image Data</td>
<td>HTTP response code</td>
</tr>
</table>
<h3>Functions Implimented</h3> <b/>
- basicAuth(user, passwd)
Sets up basic Auth for inclusion in the header
- getApplications()
Returns a JSON formatted list of applications
- createApplication(name, description)
Creates an application with defined name and description
- deleteApplication(appid)
Delete Application via appid
- updateApplicationImage(appid, imgData)
Updates the application image
- getClients()
Returns a JSON formatted list of Clients
- addClient(name)
Creates a new client with name
- deleteClient(clientid)
Delete clients via clientID
- getMessagesByApp(appid)
Returns a JSON formatted list of messages in an application
- 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