API Elements¶
Python Refact contains a registry for the API Elements Refract Profile which provide conviences around interacting with API Elements.
from refract.json import JSONDeserialiser
from refract.contrib.apielements import registry
deserialiser = JSONDeserialiser(registry=registry)
parseResult = deserialiser.deserialise('{"element": "parseResult"}')
if parseResult.errors:
print('Parse Result contained errors')
Contents
ParseResult¶
-
class
refract.contrib.apielements.ParseResult(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content=None)¶ -
annotations¶ Returns all of the annotations inside the parse result.
-
api¶ Returns an API category found within the parse result.
-
errors¶ Returns all of the error annotations in the parse result.
-
warnings¶ Returns all of the warning annotations in the parse result.
-
Annotation¶
-
class
refract.contrib.apielements.Annotation(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content: str = None)¶
Category¶
-
class
refract.contrib.apielements.Category(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content=None)¶ -
resourceGroups¶ Returns the resource group categories found within the category.
-
resources¶ Returns the resource elements found within the category.
-
transitions¶ Returns the transition elements found within the category.
-
Copy¶
-
class
refract.contrib.apielements.Copy(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content: str = None)¶
HTTPRequest¶
-
class
refract.contrib.apielements.HTTPRequest(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content=None)¶ -
assets¶ Returns the assets in the transaction.
-
body_asset¶ Returns the first body asset in the transaction.
-
body_schema_asset¶ Returns the first body schema asset in the transaction.
-
headers¶ Returns the header attributes for the HTTP message.
-
method¶ Returns the method attributes for the HTTP request.
-
HTTPResponse¶
-
class
refract.contrib.apielements.HTTPResponse(meta: refract.elements.base.Metadata = None, attributes: refract.elements.base.Attributes = None, content=None)¶ -
assets¶ Returns the assets in the transaction.
-
body_asset¶ Returns the first body asset in the transaction.
-
body_schema_asset¶ Returns the first body schema asset in the transaction.
-
headers¶ Returns the header attributes for the HTTP message.
-
status_code¶ Returns the statuc code attribute for the HTTP response.
-