from __future__ import absolute_import

__all__ = ['PluginProjectEndpoint', 'PluginGroupEndpoint']

from rest_framework.response import Response

from sentry.api.bases.group import GroupEndpoint
from sentry.api.bases.project import ProjectEndpoint
from sentry.models import GroupMeta


class PluginProjectEndpoint(ProjectEndpoint):
    view = None

    def _handle(self, request, project, *args, **kwargs):
        return self.view(request, project, *args, **kwargs)

    def get(self, request, project, *args, **kwargs):
        return self._handle(request, project, *args, **kwargs)

    def post(self, request, project, *args, **kwargs):
        return self._handle(request, project, *args, **kwargs)

    def respond(self, *args, **kwargs):
        return Response(*args, **kwargs)


class PluginGroupEndpoint(GroupEndpoint):
    view = None

    def _handle(self, request, group, *args, **kwargs):
        GroupMeta.objects.populate_cache([group])

        return self.view(request, group, *args, **kwargs)

    def get(self, request, group, *args, **kwargs):
        return self._handle(request, group, *args, **kwargs)

    def post(self, request, group, *args, **kwargs):
        return self._handle(request, group, *args, **kwargs)

    def respond(self, *args, **kwargs):
        return Response(*args, **kwargs)

@@ -317,32 +317,50 @@
 ojectEndpoint):%0A
+    plugin = None%0A
     view = None%0A
@@ -837,24 +837,42 @@
 pEndpoint):%0A
+    plugin = None%0A
     view = N

Add plugin kwarg to endpoints