# -*- coding: utf-8 -*-

class API(object):

    def __init__(self, app=None, decorators=None,
            catch_all_404s=None):
        self.app = app
        self.decorators = decorators or []
        self.catch_all_404s = catch_all_404s

@@ -145,16 +145,47 @@
 p = app%0A
+        self.endpoints = set()%0A
         
@@ -264,8 +264,742 @@
 ll_404s%0A
+%0A    def add_resource(self, resource, version, *urls, **kw):%0A        endpoint = kw.pop('endpoint', None) or resource.__name__.lower()%0A        self.endpoints.add(endpoint)%0A%0A        if endpoint in self.app.view_functions:%0A            previous_view_class = self.app.view_functions%5Bendpoint%5D.__dict__%5B'view_class'%5D%0A            if previous_view_class != resource:%0A                raise Exception, %22already set%22%0A%0A        resource.endpoint = endpoint%0A        resource_func = resource.as_view(endpoint)%0A        for decorator in self.decorators:%0A            resource_func = decorator(resource_func)%0A%0A        for url in urls:%0A            url = '/%7B%7D/%7B%7D'.format(version, url)%0A            self.app.add_url_rule(url, view_func=resource_func, **kw)%0A

Add resource.