OpenQuizz
Une application de gestion des contenus pédagogiques
|
Public Member Functions | |
def | __init__ (self, name, description=None, path=None, decorators=None, validate=None, authorizations=None, ordered=False, **kwargs) |
def | path (self) |
def | add_resource (self, resource, *urls, **kwargs) |
def | route (self, *urls, **kwargs) |
def | doc (self, shortcut=None, **kwargs) |
def | hide (self, func) |
def | abort (self, *args, **kwargs) |
def | add_model (self, name, definition) |
def | model (self, name=None, model=None, mask=None, **kwargs) |
def | schema_model (self, name=None, schema=None) |
def | extend (self, name, parent, fields) |
def | clone (self, name, *specs) |
def | inherit (self, name, *specs) |
def | expect (self, *inputs, **kwargs) |
def | parser (self) |
def | as_list (self, field) |
def | marshal_with (self, fields, as_list=False, code=HTTPStatus.OK, description=None, **kwargs) |
def | marshal_list_with (self, fields, **kwargs) |
def | marshal (self, *args, **kwargs) |
def | errorhandler (self, exception) |
def | param (self, name, description=None, _in='query', **kwargs) |
def | response (self, code, description, model=None, **kwargs) |
def | header (self, name, description=None, **kwargs) |
def | produces (self, mimetypes) |
def | deprecated (self, func) |
def | vendor (self, *args, **kwargs) |
def | payload (self) |
Data Fields | |
name | |
description | |
models | |
urls | |
decorators | |
resources | |
error_handlers | |
default_error_handler | |
authorizations | |
ordered | |
apis | |
Group resources together. Namespace is to API what :class:`flask:flask.Blueprint` is for :class:`flask:flask.Flask`. :param str name: The namespace name :param str description: An optionale short description :param str path: An optional prefix path. If not provided, prefix is ``/+name`` :param list decorators: A list of decorators to apply to each resources :param bool validate: Whether or not to perform validation on this namespace :param bool ordered: Whether or not to preserve order on models and marshalling :param Api api: an optional API to attache to the namespace
def __init__ | ( | self, | |
name, | |||
description = None , |
|||
path = None , |
|||
decorators = None , |
|||
validate = None , |
|||
authorizations = None , |
|||
ordered = False , |
|||
** | kwargs | ||
) |
def abort | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
Properly abort the current request See: :func:`~flask_restplus.errors.abort`
def add_model | ( | self, | |
name, | |||
definition | |||
) |
def add_resource | ( | self, | |
resource, | |||
* | urls, | ||
** | kwargs | ||
) |
Register a Resource for a given API Namespace :param Resource resource: the resource ro register :param str urls: one or more url routes to match for the resource, standard flask routing rules apply. Any url variables will be passed to the resource method as args. :param str endpoint: endpoint name (defaults to :meth:`Resource.__name__.lower` Can be used to reference this route in :class:`fields.Url` fields :param list|tuple resource_class_args: args to be forwarded to the constructor of the resource. :param dict resource_class_kwargs: kwargs to be forwarded to the constructor of the resource. Additional keyword arguments not specified above will be passed as-is to :meth:`flask.Flask.add_url_rule`. Examples:: namespace.add_resource(HelloWorld, '/', '/hello') namespace.add_resource(Foo, '/foo', endpoint="foo") namespace.add_resource(FooSpecial, '/special/foo', endpoint="foo")
def as_list | ( | self, | |
field | |||
) |
Allow to specify nested lists for documentation
def clone | ( | self, | |
name, | |||
* | specs | ||
) |
Clone a model (Duplicate all fields) :param str name: the resulting model name :param specs: a list of models from which to clone the fields .. seealso:: :meth:`Model.clone`
def deprecated | ( | self, | |
func | |||
) |
A decorator to mark a resource or a method as deprecated
def doc | ( | self, | |
shortcut = None , |
|||
** | kwargs | ||
) |
A decorator to add some api documentation to the decorated object
def errorhandler | ( | self, | |
exception | |||
) |
A decorator to register an error handler for a given exception
def expect | ( | self, | |
* | inputs, | ||
** | kwargs | ||
) |
A decorator to Specify the expected input model :param ModelBase|Parse inputs: An expect model or request parser :param bool validate: whether to perform validation or not
def extend | ( | self, | |
name, | |||
parent, | |||
fields | |||
) |
Extend a model (Duplicate all fields) :deprecated: since 0.9. Use :meth:`clone` instead
def header | ( | self, | |
name, | |||
description = None , |
|||
** | kwargs | ||
) |
A decorator to specify one of the expected headers :param str name: the HTTP header name :param str description: a description about the header
def hide | ( | self, | |
func | |||
) |
A decorator to hide a resource or a method from specifications
def inherit | ( | self, | |
name, | |||
* | specs | ||
) |
Inherit a modal (use the Swagger composition pattern aka. allOf) .. seealso:: :meth:`Model.inherit`
def marshal | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
A shortcut to the :func:`marshal` helper
def marshal_list_with | ( | self, | |
fields, | |||
** | kwargs | ||
) |
A shortcut decorator for :meth:`~Api.marshal_with` with ``as_list=True``
def marshal_with | ( | self, | |
fields, | |||
as_list = False , |
|||
code = HTTPStatus.OK , |
|||
description = None , |
|||
** | kwargs | ||
) |
A decorator specifying the fields to use for serialization. :param bool as_list: Indicate that the return type is a list (for the documentation) :param int code: Optionally give the expected HTTP response code if its different from 200
def model | ( | self, | |
name = None , |
|||
model = None , |
|||
mask = None , |
|||
** | kwargs | ||
) |
Register a model .. seealso:: :class:`Model`
def param | ( | self, | |
name, | |||
description = None , |
|||
_in = 'query' , |
|||
** | kwargs | ||
) |
A decorator to specify one of the expected parameters :param str name: the parameter name :param str description: a small description :param str _in: the parameter location `(query|header|formData|body|cookie)`
def parser | ( | self | ) |
Instanciate a :class:`~RequestParser`
def path | ( | self | ) |
def payload | ( | self | ) |
Store the input payload in the current request context
def produces | ( | self, | |
mimetypes | |||
) |
A decorator to specify the MIME types the API can produce
def response | ( | self, | |
code, | |||
description, | |||
model = None , |
|||
** | kwargs | ||
) |
A decorator to specify one of the expected responses :param int code: the HTTP status code :param str description: a small description about the response :param ModelBase model: an optional response model
def route | ( | self, | |
* | urls, | ||
** | kwargs | ||
) |
A decorator to route resources.
def schema_model | ( | self, | |
name = None , |
|||
schema = None |
|||
) |
Register a model .. seealso:: :class:`Model`
def vendor | ( | self, | |
* | args, | ||
** | kwargs | ||
) |
A decorator to expose vendor extensions. Extensions can be submitted as dict or kwargs. The ``x-`` prefix is optionnal and will be added if missing. See: http://swagger.io/specification/#specification-extensions-128
apis |
authorizations |
decorators |
default_error_handler |
description |
error_handlers |
models |
name |
ordered |
resources |
urls |