Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build Feature Flag Endpoints #2248

Open
tobi-bams opened this issue Dec 19, 2024 · 3 comments
Open

Build Feature Flag Endpoints #2248

tobi-bams opened this issue Dec 19, 2024 · 3 comments
Labels

Comments

@tobi-bams
Copy link
Contributor

tobi-bams commented Dec 19, 2024

Breakdown of feature flag system in: #2235

1. GET /feature_flags

  • Description:
    This endpoint retrieves a list of all feature flags, including their status (enabled) and associated endpoints.

  • Response:

    • The response will return a structured object with the following fields:
      • success: A boolean indicating whether the operation was successful.
      • message: A descriptive message (e.g., "Feature flags fetched successfully").
      • data: An array of feature flag objects containing the details of each feature flag
  • Example Response:

{
  "success": true,
  "message": "Feature flags fetched successfully.",
  "data": [
    {
      "name": "FF_Chat",
      "description": "Enables chat feature",
      "enabled": true,
      "uuid": "123e4567-e89b-12d3-a456-426614174000",
      "endpoints": [
        { "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
        { "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
      ]
    },
    {
      "name": "FF_Payments",
      "description": "Enables payments feature",
      "enabled": false,
      "uuid": "123e4567-e89b-12d3-a456-426614174001",
      "endpoints": [
        { "path": "/api/v1/payment", "uuid": "567e4567-e89b-12d3-a456-426614174113" }
      ]
    }
  ]
}

2. POST /feature_flags

  • Description:
    This endpoint allows admins to create a new feature flag with associated endpoints.

  • Request Body:

{
  "name": "FF_Chat",
  "description": "Enables chat feature",
  "enabled": false,
  "endpoints": ["/api/v1/chat", "/api/v1/chat/:id"]
}
  • Response:

    • The response will return the newly created feature flag object, along with a success status, a message, and the created data.
  • Example Response:

{
  "success": true,
  "message": "Feature flag created successfully.",
  "data": {
    "name": "FF_Chat",
    "description": "Enables chat feature",
    "enabled": false,
    "uuid": "123e4567-e89b-12d3-a456-426614174000",
    "endpoints": [
      { "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
      { "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
    ]
  }
}

3. PUT /feature_flags/{id}

  • Description:
    This endpoint allows admins to update an existing feature flag’s name, description, and enabled status.

  • Request Body:

{
  "name": "FF_Chat",
  "description": "Enables chat feature with enhancements",
  "enabled": true
}
  • Response:

    • The response will return the updated feature flag object, along with a success status, a message, and the updated data.
  • Example Response:

{
  "success": true,
  "message": "Feature flag updated successfully.",
  "data": {
    "name": "FF_Chat",
    "description": "Enables chat feature with enhancements",
    "enabled": true,
    "uuid": "123e4567-e89b-12d3-a456-426614174000",
    "endpoints": [
      { "path": "/api/v1/chat", "uuid": "567e4567-e89b-12d3-a456-426614174111" },
      { "path": "/api/v1/chat/:id", "uuid": "567e4567-e89b-12d3-a456-426614174112" }
    ]
  }
}

4. DELETE /feature_flags/{id}

  • Description:
    This endpoint allows admins to delete an existing feature flag along with its associated endpoints.

  • Response:

    • The response will return a success status, a message indicating whether the deletion was successful, and an appropriate error message if the feature flag was not found.
  • Example Response (Success):

{
  "success": true,
  "message": "Feature flag successfully deleted.",
  "data": null
}
  • Example Response (Not Found):
{
  "success": false,
  "message": "Feature flag not found.",
  "data": null
}
@Shoaibdev7
Copy link
Contributor

@humansinstitute @tobi-bams assign me?

@aliraza556
Copy link
Contributor

@tobi-bams @humansinstitute Please assign me?

@MahtabBukhari
Copy link
Contributor

@tobi-bams @humansinstitute assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants