Base Resources

Base classes to implement UID validation and shared file metadata

../_images/lfview_resources_files_base.png

Doc links: _BaseFile _BaseUIDModel HasProperties

class lfview.resources.files.base._BaseUIDModel(**kwargs)

Base class with UID property and validation methods

This class is used to enable pointer validation when used with properties.extras.Pointer. When a _BaseUIDModel subclass is specified as the instance class on a Pointer, the value assigned to that pointer can either be an instance of this class OR a validated UID value.

For LF View API resources, the UID must end with slash-delimited type information (defined by BASE_TYPE and SUB_TYPE) and random identifier. Most commonly, these UIDs will be resource URLs; for example,

https://example.com/api/v1/elements/surface/d7td9elq5k9ewdu557hk

is a valid UID with base type ‘elements’ and subtype ‘surface.’ An equally valid UID is

elements/surface/d7td9elq5k9ewdu557hk

but without the full URL, the value may not be recognized by the LF View REST API.

Optional Properties:

  • uid (String): Unique object identifier, a unicode string
class lfview.resources.files.base._BaseFile(**kwargs)

Base class for File resources

The properties defined here apply to any generic file. Note that this file resource does not actually store the binary file itself, only its metadata.

Required Properties:

  • content_length (Integer): Content length of the file, an integer in range [0, inf]
  • content_type (String): Content type of the file, a unicode string

Optional Properties:

  • uid (String): Unique object identifier, a unicode string