docs: def add_resource(
          self,
          base_rule,
          base_view,
          alternate_view=None,
          alternate_rule=None,
          id_rule=None,
          app=None,
      ):
          """Add route or routes for a resource.
  
          :param str base_rule: The URL rule for the resource. This will be
              prefixed by the API prefix.
          :param base_view: Class-based view for the resource.
          :param alternate_view: If specified, an alternate class-based view for
              the resource. Usually, this will be a detail view, when the base
              view is a list view.
          :param alternate_rule: If specified, the URL rule for the alternate
              view. This will be prefixed by the API prefix. This is mutually
              exclusive with id_rule, and must not be specified if alternate_view
              is not specified.
          :type alternate_rule: str or None
          :param id_rule: If specified, a suffix to append to base_rule to get
              the alternate view URL rule. If alternate_view is specified, and
              alternate_rule is not, then this defaults to '<id>'. This is
              mutually exclusive with alternate_rule, and must not be specified
              if alternate_view is not specified.
          :type id_rule: str or None
          :param app: If specified, the application to which to add the route(s).
              Otherwise, this will be the bound application, if present.
          """
          if alternate_view:
              if not alternate_rule:
                  id_rule = id_rule or DEFAULT_ID_RULE
                  alternate_rule = posixpath.join(base_rule, id_rule)
              else:
                  assert id_rule is None
          else:
              assert alternate_rule is None
              assert id_rule is None
  
          app = self._get_app(app)
          endpoint = self._get_endpoint(base_view, alternate_view)
  
          # Store the view rules for reference. Doesn't support multiple routes
          # mapped to same view.
          views = app.extensions['resty'].views
  
          base_rule_full = '{}{}'.format(self.prefix, base_rule)
          base_view_func = base_view.as_view(endpoint)
  
          if not alternate_view:
              app.add_url_rule(base_rule_full, view_func=base_view_func)
              views[base_view] = Resource(base_view, base_rule_full)
              return
  
          alternate_rule_full = '{}{}'.format(self.prefix, alternate_rule)
          alternate_view_func = alternate_view.as_view(endpoint)
  
          @functools.wraps(base_view_func)
          def view_func(*args, **kwargs):
              if flask.request.url_rule.rule == base_rule_full:
                  return base_view_func(*args, **kwargs)
              else:
                  return alternate_view_func(*args, **kwargs)
  
          app.add_url_rule(
              base_rule_full, view_func=view_func, endpoint=endpoint,
              methods=base_view.methods,
          )
          app.add_url_rule(
              alternate_rule_full, view_func=view_func, endpoint=endpoint,
              methods=alternate_view.methods,
          )
  
          views[base_view] = Resource(base_view, base_rule_full)
          views[alternate_view] = Resource(alternate_view, alternate_rule_full)