def deleteAllMessages(self): """ Delete all messages """ url = "https://habitica.com/api/v3/user/messages" return(deleteUrl(url, self.credentials))
def deleteMessage(self, messageId): """ Delete a message id: te id of the message to delete """ url = "https://habitica.com/api/v3/user/messages/" + messageId return(deleteUrl(url, self.credentials))
def deleteChallenge(creds, challengeId): """ Delete a challenge creds: a dictionary of user credentials formatted as: {'x-api-user': '******', 'x-api-key': 'your_api_key'} challengeId: The challenge _id. Type: UUID """ url = "https://habitica.com/api/v3/challenges/" + challengeId return (deleteUrl(url, creds))
def deleteTask(creds, taskId): """ Task - Delete a task given its id creds: a dictionary of user credentials formatted as: {'x-api-user': '******', 'x-api-key': 'your_api_key'} taskId: The task _id or alias """ url = "https://habitica.com/api/v3/tasks/" + taskId return (deleteUrl(url, creds))
def deleteTask(self): """ Task - Delete a task given its id TODO: test """ url = "https://habitica.com/api/v3/tasks/" + self.id return (deleteUrl(url, self.credentials))
def deleteUser(self, password, feedback=""): """ Delete an authenticated user's account password: The user's password if the account uses local authentication feedback: User's optional feedback explaining reasons for deletion """ url = "https://habitica.com/api/v3/user" payload = {'password': password, 'feedback': feedback} return(deleteUrl(url, self.credentials, payload))
def deleteChecklist(self, itemId): """ Task - Delete a checklist item from a task itemId: The checklist item _id """ url = "https://habitica.com/api/v3/tasks/" + self.id + "/checklist/" + itemId response = deleteUrl(url, self.credentials) self.checklist.remove(itemId) return (response)
def removeTag(creds, taskId, tagId): """ Task - Delete a tag from a task creds: a dictionary of user credentials formatted as: {'x-api-user': '******', 'x-api-key': 'your_api_key'} taskId: The task _id or alias tagId: The tag id """ url = "https://habitica.com/api/v3/tasks/" + taskId + "/tags/" + tagId return (deleteUrl(url, creds))
def deleteChecklist(creds, taskId, itemId): """ Task - Delete a checklist item from a task creds: a dictionary of user credentials formatted as: {'x-api-user': '******', 'x-api-key': 'your_api_key'} taskId: The task _id or alias itemId: The checklist item _id """ url = "https://habitica.com/api/v3/tasks/" + taskId + "/checklist/" + itemId return (deleteUrl(url, creds))
def removeTag(self, tagId): """ Task - Delete a tag from a task tagId: The tag id """ url = "https://habitica.com/api/v3/tasks/" + self.id + "/tags/" + tagId response = deleteUrl(url, self.credentials) self.tags.remove(tagId) return (response)
def deleteSocialAuthentication(self, network): """ Delete social authentication method Remove a social authentication method (only facebook supported) from a user profile. The user must have local authentication enabled """ url = "https://habitica.com/api/v3/user/auth/social/" + network return(deleteUrl(url, self.credentials))
def deleteMessage(self, previousMsg=None): """ Deletes a chat message from a group chatId: The chat message id previousMsg: The last message's ID fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime """ if previousMsg == None: url = 'https://habitica.com/api/v3/groups/' + self.groupId + '/chat/' + self.chatId + '/clearflags' else: url = 'https://habitica.com/api/v3/groups/' + self.groupId + '/chat/' + self.chatId + '/clearflags?previousMsg=' + previousMsg return (deleteUrl(url, self.credentials))
def deleteMessage(creds, chatId, groupId='party', previousMsg=None): """ Deletes a chat message from a group creds: a dictionary of user credentials formatted as: {'x-api-user': '******', 'x-api-key': 'your_api_key'} chatId: The chat message id groupId: The group _id (or 'party'). Type: UUID previousMsg: The last message's ID fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime """ if previousMsg == None: url = 'https://habitica.com/api/v3/groups/' + groupId + '/chat/' + chatId + '/clearflags' else: url = 'https://habitica.com/api/v3/groups/' + groupId + '/chat/' + chatId + '/clearflags?previousMsg=' + previousMsg return (deleteUrl(url, creds))
def deleteTag(credentials, tagId): """Delete a user tag given its ID. Args: credentials (dict): Formatted dictionary of user id and api key. If a user object has already been created, use user.credentials. format: {'x-api-user': "******", 'x-api-key': "api_key_here"} tagId (str): the tag's ID. Returns: A JSON response object. Keys: userV, notifications, data, appVersion, success. """ url = "https://habitica.com/api/v3/tags/" + tagId return(deleteUrl(url, credentials))
def deleteMessage(self, previousMsg=None): """Deletes a message from a chat Args: previousMsg (str): The last message's ID fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime. Optional. Returns: A JSON response object. Keys: userV, notifications, data, appVersion, success. """ if previousMsg == None: url = 'https://habitica.com/api/v3/groups/' + self.groupId + '/chat/' + self.chatId + '/clearflags' else: url = 'https://habitica.com/api/v3/groups/' + self.groupId + '/chat/' + self.chatId + '/clearflags?previousMsg=' + previousMsg return (deleteUrl(url, self.credentials))
def deleteMessage(creds, chatId, groupId='party', previousMsg=None): """Deletes a chat message from a group Args: creds (dict): Formatted dictionary of user id and api key. If a user object has already been created, use user.credentials. format: {'x-api-user': "******", 'x-api-key': "api_key_here"} chatId (str): The chat message id. groupId (str): The group id (or 'party'). Default: 'party'. previousMsg (str): The last message's ID fetched by the client so that the whole chat will be returned only if new messages have been posted in the meantime. Optional. Returns: A JSON response object. Keys: userV, notifications, data, appVersion, success. """ if previousMsg == None: url = 'https://habitica.com/api/v3/groups/' + groupId + '/chat/' + chatId + '/clearflags' else: url = 'https://habitica.com/api/v3/groups/' + groupId + '/chat/' + chatId + '/clearflags?previousMsg=' + previousMsg return (deleteUrl(url, creds))
def deleteChallenge(self): """ Delete a challenge """ url = "https://habitica.com/api/v3/challenges/" + self.id return (deleteUrl(url, self.credentials))