2.1. Tags

class backendapp.tags.schemas.ConsumerTagSchema(*args, **kwargs)[source]

A schema for serialising Tag instances, which excludes sensitive information like the secretkey.

It is for use with open-access (consumer) API-endpoints.

class Meta[source]

Do not serialise the secretkey. The database ID is excluded as well, because consumer endpoints refer to tags by the 8-character serial string only.

However, it is still possible to deserialize the secretkey and ID etc. into a database object.

model

alias of backendapp.tags.models.Tag

consumer_captures_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A URL to the list of captures made by this tag, from the Consumer API.

consumer_samples_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A URL to the samples captured from this tag, from the Consumer API.

consumer_tag_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A self-referencing URL for this tag in the Consumer API.

consumer_webhook_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A URL to the webhook associated with this tag, from the Consumer API.

class backendapp.tags.schemas.TagSchema(*args, **kwargs)[source]

Schema for serialising a Tag read from the database.

This is for administrators only. Nearly all attributes (including the secretkey) are returned.

class Meta[source]

For brevity, do not include a list of captures with each serialized tag. A URL to these data will suffice.

model

alias of backendapp.tags.models.Tag

admin_captures_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A URL to the list of captures made by this tag.

admin_simulate_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A URL that simulates text (actually another URL) that will be read from the tag over NFC.

admin_tag_url(obj)[source]
Parameters

obj – The tag SQLAlchemy object to be serialised.

Returns

A self-referencing URL for this tag in the Admin API.