Real-Dev-Squad / discord-slash-commands

MIT License
4 stars 26 forks source link

Feature: Create Discord API Endpoint to Remove Role from User #82

Closed RitikJaiswal75 closed 1 year ago

RitikJaiswal75 commented 1 year ago

Pull Request Description: Feature: Create Discord API Endpoint to Remove Role from User

Description:

This pull request introduces a new feature to the existing application, providing the ability to remove a specific role from a user in Discord through a DELETE API endpoint. The implementation involves utilizing the Discord API to handle the role removal operation efficiently and securely.

Key Changes:

  1. New API Endpoint: A new API endpoint, DELETE /role, has been implemented to facilitate the removal of a role from a user. This endpoint accepts the necessary parameters, such as the user's unique identifier and the role's unique identifier, to accurately identify the user and the role to be removed.

  2. Discord API Integration: The application has been integrated with the Discord API to enable seamless communication and interaction. The API client library handles the authentication and authorization process, ensuring secure requests are sent to the Discord server.

  3. Role Removal Functionality: The logic for removing a role from a user has been implemented within the API endpoint. When the endpoint is invoked with the appropriate parameters, it leverages the Discord API's provided methods to perform the role removal operation successfully.

  4. Error Handling: This pull request includes robust error handling mechanisms to manage various scenarios, such as invalid user or role identifiers, network failures, or any other potential errors encountered during the API call. Detailed error messages and appropriate HTTP status codes are returned to the client for effective troubleshooting.

Testing:

Unit tests have been added to ensure the correctness and reliability of the implemented functionality. The tests cover different use cases, including successful role removal, error scenarios, and edge cases. Mocking techniques have been employed to simulate API responses and guarantee accurate testing results.

Documentation:

The API documentation has been updated to include details about the new endpoint, its parameters, expected responses, and potential error codes. Clear instructions and examples are provided to guide developers on how to utilize this functionality effectively.

Please review this pull request and provide your feedback, suggestions, and any concerns you may have.