Data Models
The SDK is expected to be used in a variety of projects, and to that end it defines a stable public interface. Care must be taken to avoid exposing the inner workings on the SDK including its data model.
Public interface
The public interface of the SDK is anything that is exposed externally, be it function names, types, or exposed models. The SDK generally exposes request and response models that contains the expected data for each API call.
We can generally group the public models into the following categories:
- View models: Models that generally represents a decrypted state, examples are
CipherView
,CipherListView
,FolderView
, etc. - Request models: Models that are used to send data into the SDK. Some examples are
ProjectGetRequest
,ProjectCreateRequest
, etc. - Response models: Returns data from the SDK e.g.
ProjectResponse
.
Internal models
The SDK also maintains internal models:
- API models: Auto-generated models that are used to interact with the server.
- Domain models: General data models used to represent a specific concern in the SDK. For
example,
Cipher
,Folder
, etc. - DTO: Data Transfer Objects are used to transfer data between layers of the SDK. They are generally used to decouple the domain models from the API models.