2018-04-17 12:18:40 +00:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""OpenAPI core operations models module"""
|
|
|
|
|
|
|
|
|
|
|
|
class Operation(object):
|
|
|
|
"""Represents an OpenAPI Operation."""
|
|
|
|
|
|
|
|
def __init__(
|
|
|
|
self, http_method, path_name, responses, parameters,
|
2019-10-21 22:16:24 +00:00
|
|
|
summary=None, description=None, external_docs=None, security=None,
|
|
|
|
request_body=None, deprecated=False, operation_id=None, tags=None,
|
2020-03-03 13:01:45 +00:00
|
|
|
servers=None, extensions=None):
|
2018-04-17 12:18:40 +00:00
|
|
|
self.http_method = http_method
|
|
|
|
self.path_name = path_name
|
|
|
|
self.responses = dict(responses)
|
|
|
|
self.parameters = dict(parameters)
|
2019-10-21 22:16:24 +00:00
|
|
|
self.summary = summary
|
|
|
|
self.description = description
|
|
|
|
self.external_docs = external_docs
|
2021-02-02 12:39:53 +00:00
|
|
|
self.security = security and list(security)
|
2018-04-17 12:18:40 +00:00
|
|
|
self.request_body = request_body
|
|
|
|
self.deprecated = deprecated
|
|
|
|
self.operation_id = operation_id
|
2018-08-31 14:57:53 +00:00
|
|
|
self.tags = tags
|
2019-10-21 22:16:24 +00:00
|
|
|
self.servers = servers
|
2018-04-17 12:18:40 +00:00
|
|
|
|
2020-03-03 13:01:45 +00:00
|
|
|
self.extensions = extensions and dict(extensions) or {}
|
|
|
|
|
2018-04-17 12:18:40 +00:00
|
|
|
def __getitem__(self, name):
|
|
|
|
return self.parameters[name]
|