@util.positional(<NUM_LIT:2>)<EOL>def method(request_message=message_types.VoidMessage,<EOL>response_message=message_types.VoidMessage,<EOL>name=None,<EOL>path=None,<EOL>http_method='<STR_LIT:POST>',<EOL>scopes=None,<EOL>audiences=None,<EOL>allowed_client_ids=None,<EOL>auth_level=None,<EOL>api_key_required=None,<EOL>metric_costs=None,<EOL>use_request_uri=None):
if auth_level is not None:<EOL><INDENT>_logger.warn(_AUTH_LEVEL_WARNING)<EOL><DEDENT>DEFAULT_HTTP_METHOD = '<STR_LIT:POST>'<EOL>def apiserving_method_decorator(api_method):<EOL><INDENT>"""<STR_LIT>"""<EOL>request_body_class = None<EOL>request_params_class = None<EOL>if isinstance(request_message, resource_container.ResourceContainer):<EOL><INDENT>remote_decorator = remote.method(request_message.combined_message_class,<EOL>response_message)<EOL>request_body_class = request_message.body_message_class()<EOL>request_params_class = request_message.parameters_message_class()<EOL><DEDENT>else:<EOL><INDENT>remote_decorator = remote.method(request_message, response_message)<EOL><DEDENT>remote_method = remote_decorator(api_method)<EOL>def invoke_remote(service_instance, request):<EOL><INDENT>users_id_token._maybe_set_current_user_vars(<EOL>invoke_remote, api_info=getattr(service_instance, '<STR_LIT>', None),<EOL>request=request)<EOL>return remote_method(service_instance, request)<EOL><DEDENT>invoke_remote.remote = remote_method.remote<EOL>if isinstance(request_message, resource_container.ResourceContainer):<EOL><INDENT>resource_container.ResourceContainer.add_to_cache(<EOL>invoke_remote.remote, request_message)<EOL><DEDENT>invoke_remote.method_info = _MethodInfo(<EOL>name=name or api_method.__name__, path=path or api_method.__name__,<EOL>http_method=http_method or DEFAULT_HTTP_METHOD,<EOL>scopes=scopes, audiences=audiences,<EOL>allowed_client_ids=allowed_client_ids, auth_level=auth_level,<EOL>api_key_required=api_key_required, metric_costs=metric_costs,<EOL>use_request_uri=use_request_uri,<EOL>request_body_class=request_body_class,<EOL>request_params_class=request_params_class)<EOL>invoke_remote.__name__ = invoke_remote.method_info.name<EOL>return invoke_remote<EOL><DEDENT>endpoints_util.check_list_type(scopes, (basestring, endpoints_types.OAuth2Scope), '<STR_LIT>')<EOL>endpoints_util.check_list_type(allowed_client_ids, basestring,<EOL>'<STR_LIT>')<EOL>_CheckEnum(auth_level, AUTH_LEVEL, '<STR_LIT>')<EOL>_CheckAudiences(audiences)<EOL>_CheckType(metric_costs, dict, '<STR_LIT>')<EOL>return apiserving_method_decorator<EOL>
Decorate a ProtoRPC Method for use by the framework above.

    This decorator can be used to specify a method name, path, http method,
    scopes, audiences, client ids and auth_level.

    Sample usage:
      @api_config.method(RequestMessage, ResponseMessage,
                         name='insert', http_method='PUT')
      def greeting_insert(request):
        ...
        return response

    Args:
      request_message: Message type of expected request.
      response_message: Message type of expected response.
      name: string, Name of the method, prepended with <apiname>. to make it
        unique. (Default: python method name)
      path: string, Path portion of the URL to the method, for RESTful methods.
      http_method: string, HTTP method supported by the method. (Default: POST)
      scopes: list of string, OAuth2 token must contain one of these scopes.
      audiences: list of string, IdToken must contain one of these audiences.
      allowed_client_ids: list of string, Client IDs allowed to call the method.
        If None and auth_level is REQUIRED, no calls will be allowed.
      auth_level: enum from AUTH_LEVEL, Frontend auth level for the method.
      api_key_required: bool, whether a key is required to call the method
      metric_costs: dict with keys matching an API limit metric and values
        representing the cost for each successful call against that metric.
      use_request_uri: if true, match requests against REQUEST_URI instead of PATH_INFO

    Returns:
      'apiserving_method_wrapper' function.

    Raises:
      TypeError: if the request_type or response_type parameters are not
        proper subclasses of messages.Message.