Exemplo n.º 1
0
	def deleteAllMessages(self):
		"""
		Delete all messages

		"""
		url = "https://habitica.com/api/v3/user/messages"
		return(deleteUrl(url, self.credentials))
Exemplo n.º 2
0
	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))
Exemplo n.º 3
0
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))
Exemplo n.º 4
0
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))
Exemplo n.º 5
0
    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))
Exemplo n.º 6
0
	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))
Exemplo n.º 7
0
    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)
Exemplo n.º 8
0
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))
Exemplo n.º 9
0
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))
Exemplo n.º 10
0
    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)
Exemplo n.º 11
0
	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))
Exemplo n.º 12
0
    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))
Exemplo n.º 13
0
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))
Exemplo n.º 14
0
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))
Exemplo n.º 15
0
    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))
Exemplo n.º 16
0
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))
Exemplo n.º 17
0
        def deleteChallenge(self):
            """
			Delete a challenge
			"""
            url = "https://habitica.com/api/v3/challenges/" + self.id
            return (deleteUrl(url, self.credentials))