Skip to content

Commit

Permalink
Remove delete_integration rest endpoint as it dupes leave guild (#243)
Browse files Browse the repository at this point in the history
  • Loading branch information
FasterSpeeding authored Sep 27, 2020
1 parent 048960e commit cace06f
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 56 deletions.
39 changes: 0 additions & 39 deletions hikari/api/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -4357,45 +4357,6 @@ async def fetch_integrations(
If an internal error occurs on Discord while handling the request.
"""

@abc.abstractmethod
async def delete_integration(
self,
guild: snowflakes.SnowflakeishOr[guilds.PartialGuild],
integration: snowflakes.SnowflakeishOr[guilds.Integration],
*,
reason: undefined.UndefinedOr[str] = undefined.UNDEFINED,
) -> None:
"""Delete a guild's integration.
Parameters
----------
guild : hikari.snowflakes.SnowflakeishOr[hikari.guilds.PartialGuild]
The guild to delete the integration in. This may be the object
or the ID of an existing channel.
integration : hikari.snowflakes.SnowflakeishOr[hikari.guilds.Integration]
The integration delete. This may be the object
or the ID of an existing integration.
Raises
------
hikari.errors.ForbiddenError
If you are missing the `MANAGE_GUILD` permission.
hikari.errors.UnauthorizedError
If you are unauthorized to make the request (invalid/missing token).
hikari.errors.NotFoundError
If the guild is not found.
hikari.errors.RateLimitedError
Usually, Hikari will handle and retry on hitting
rate-limits automatically. This includes bucket-specific
rate-limits and global rate-limits. In some rare edge cases,
however, Discord implements other undocumented rules for
rate-limiting, such as limits per attribute. These cannot be
detected or handled normally by Hikari due to their undocumented
nature, and will trigger this exception if they occur.
hikari.errors.InternalServerError
If an internal error occurs on Discord while handling the request.
"""

@abc.abstractmethod
async def fetch_widget(self, guild: snowflakes.SnowflakeishOr[guilds.PartialGuild]) -> guilds.GuildWidget:
"""Fetch a guilds's widget.
Expand Down
10 changes: 0 additions & 10 deletions hikari/impl/rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2264,16 +2264,6 @@ async def fetch_integrations(
response = typing.cast(data_binding.JSONArray, raw_response)
return data_binding.cast_json_array(response, self._entity_factory.deserialize_integration)

async def delete_integration(
self,
guild: snowflakes.SnowflakeishOr[guilds.PartialGuild],
integration: snowflakes.SnowflakeishOr[guilds.Integration],
*,
reason: undefined.UndefinedOr[str] = undefined.UNDEFINED,
) -> None:
route = routes.DELETE_GUILD_INTEGRATION.compile(guild=guild, integration=integration)
await self._request(route, reason=reason)

async def fetch_widget(self, guild: snowflakes.SnowflakeishOr[guilds.PartialGuild]) -> guilds.GuildWidget:
route = routes.GET_GUILD_WIDGET.compile(guild=guild)
raw_response = await self._request(route)
Expand Down
7 changes: 0 additions & 7 deletions tests/hikari/impl/test_rest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2377,13 +2377,6 @@ async def test_fetch_integrations(self, rest_client):
[mock.call({"id": "456"}), mock.call({"id": "789"})]
)

async def test_delete_integration(self, rest_client):
expected_route = routes.DELETE_GUILD_INTEGRATION.compile(guild=123, integration=456)
rest_client._request = mock.AsyncMock()

await rest_client.delete_integration(StubModel(123), StubModel(456), reason="dont need it anymore")
rest_client._request.assert_awaited_once_with(expected_route, reason="dont need it anymore")

async def test_fetch_widget(self, rest_client):
widget = StubModel(789)
expected_route = routes.GET_GUILD_WIDGET.compile(guild=123)
Expand Down

0 comments on commit cace06f

Please sign in to comment.