From 81f0c560793059dbfdb98f2b3991bbfc8dae2422 Mon Sep 17 00:00:00 2001 From: grey-cat-1908 Date: Sat, 12 Mar 2022 11:24:45 +0300 Subject: [PATCH] http DELETE request method --- melisa/core/http.py | 33 ++++++++++++++++++++++++++++++--- 1 file changed, 30 insertions(+), 3 deletions(-) diff --git a/melisa/core/http.py b/melisa/core/http.py index 8e127cc..b009011 100644 --- a/melisa/core/http.py +++ b/melisa/core/http.py @@ -72,7 +72,7 @@ class HTTPClient: params: Optional[Dict] = None ) -> Optional[Dict]: """|coro| - Sends a GET request to a Discord REST endpoint. + Sends a GET request to a Discord REST API endpoint. Parameters ---------- @@ -98,7 +98,7 @@ class HTTPClient: data: Optional[Dict] = None ) -> Optional[Dict]: """|coro| - Sends a POST request to a Discord REST endpoint. + Sends a POST request to a Discord REST API endpoint. Parameters ---------- @@ -110,7 +110,7 @@ class HTTPClient: Returns ------- Optional[:class:`Dict`] - JSON response from the discord API. + JSON response from the Discord API. """ return await self.__send( "POST", @@ -118,3 +118,30 @@ class HTTPClient: json=data, ) + async def delete( + self, + route: str, + headers: dict = None + ) -> Optional[Dict]: + """|coro| + Sends a DELETE request to a Discord REST API endpoint. + + Parameters + ---------- + route : :class:`str` + The endpoint to send the request to. + headers : :class:`dict` + Custom request headers + + Returns + ------- + Optional[:class:`Dict`] + JSON response from the Discord API. + """ + return await self.__send( + "DELETE", + route, + headers=headers + ) + +