Types

JavaScript

Basic types

BasicType

type BasicType = string | number | boolean;

NullType

type NullType = null;

UndefinedType

type UndefinedType = undefined;

ObjectType

type ObjectType = {
[key: string]: ObjectType | ArrayType | BasicType | NullType | UndefinedType | Action,
};

ArrayType

type ArrayType = Array<ArrayType | ObjectType | BasicType | NullType | UndefinedType>;

CompositeType

type CompositeType = ArrayType | ObjectType;

DetaType

type DetaType = ArrayType | ObjectType | BasicType;

Action types

ActionTypes

enum ActionTypes {
Set = "set",
Trim = "trim",
Increment = "increment",
Append = "append",
Prepend = "prepend",
}

Action

class Action {
readonly operation: ActionTypes;
readonly value: any;
constructor(action: ActionTypes, value?: any);
}

Base types

PutOptions

interface PutOptions {
expireIn?: number;
expireAt?: Date | number;
}
PropertyTypeDescription
expireIn?numberItem will expire in expireIn seconds after a successfull put operation, see also expiring items.
expireAt?Date | numberItem will expire at expireAt date, see also expiring items.

InsertOptions

interface InsertOptions {
expireIn?: number;
expireAt?: Date | number;
}
PropertyTypeDescription
expireIn?numberItem will expire in expireIn seconds after a successfull put operation, see also expiring items.
expireAt?Date | numberItem will expire at expireAt date, see also expiring items.

PutManyOptions

interface PutManyOptions {
expireIn?: number;
expireAt?: Date | number;
}
PropertyTypeDescription
expireIn?numberItem will expire in expireIn seconds after a successfull put operation, see also expiring items.
expireAt?Date | numberItem will expire at expireAt date, see also expiring items.

UpdateOptions

interface UpdateOptions {
expireIn?: number;
expireAt?: Date | number;
}
PropertyTypeDescription
expireIn?numberItem will expire in expireIn seconds after a successfull put operation, see also expiring items.
expireAt?Date | numberItem will expire at expireAt date, see also expiring items.

FetchOptions

interface FetchOptions {
limit?: number;
last?: string;
desc?: boolean;
}
PropertyTypeDescription
limit?numberMaximum number of items you want to retreive, minimum value 1.
last?stringLast key seen in a previous paginated response.
desc?boolSort items in descending order by their keys, default false.

PutResponse

type PutResponse = ObjectType | NullType;

GetResponse

type GetResponse = ObjectType | NullType;

DeleteResponse

type DeleteResponse = NullType;

InsertResponse

type InsertResponse = ObjectType;

PutManyResponse

interface PutManyResponse {
processed: {
items: ArrayType,
};
}

UpdateResponse

type UpdateResponse = NullType;

FetchResponse

interface FetchResponse {
items: ObjectType[];
count: number;
last?: string;
}
PropertyTypeDescription
itemsObjectType[]List of items retreived.
countnumberNumber of items in the response.
last?stringLast key seen in the fetch response. If last is not undefined, further items are to be retreived.

Drive types

PutOptions

interface PutOptions {
data?: string | Uint8Array | Buffer;
path?: string;
contentType?: string;
}
PropertyTypeDescription
data?string | Uint8Array | BufferEither the data string or a buffer.
path?stringPath of the file to be uploaded to drive.
contentType?stringContent type of the file. If not provided, Drive tries to figure out the content type from the name. Defaults to application/octet-stream if it can not be determined.

ListOptions

interface ListOptions {
recursive?: boolean;
prefix?: string;
limit?: number;
last?: string;
}
PropertyTypeDescription
recursive?booleanIf true, the list operation will be performed recursively.
prefix?stringA prefix that file names must start with to be returned.
limit?numberMaximum number of file names to be returned, defaults to 1000.
last?stringLast name seen in a previous paginated response.

PutResponse

type PutResponse = string;

The name of a file that was uploaded.

GetResponse

type GetResponse = Blob | NullType;

The content of a file if found, otherwise null.

DeleteResponse

type DeleteResponse = string;

The name of a file that was deleted.

DeleteManyResponse

interface DeleteManyResponse {
deleted: string[];
failed: {
[key: string]: string,
};
}
PropertyTypeDescription
deletedstring[]Names of files that were deleted.
failedobjectNames of files that failed to be deleted.

ListResponse

interface ListResponse {
names: string[];
paging: {
size: number,
last: string,
};
}
PropertyTypeDescription
namesstring[]Names of files.
pagingobjectContains paging information.
paging.sizenumberNumber of files returned.
paging.laststringLast name seen in the paginated response. For the last page, last is not present in the response.

Golang

Deta

type Deta struct {
ProjectKey string
}

ConfigOption

type ConfigOption func(*Deta)

Base types

Base

type Base struct {
Util *util
}

Query

type Query []map[string]interface{}

Updates

type Updates map[string]interface{}

FetchInput

type FetchInput struct {
Q Query
Dest interface{}
Limit int
LastKey string
Desc bool
}
FieldTypeDescription
QQueryFilters to apply to items.
Destinterface{}The destination to store the results.
LimitintThe maximum number of items to fetch. A value of 0 or less applies no limit.
LastKeystringThe last key evaluated in a paginated response. Leave empty if not a subsequent fetch request.
DescboolSort items in descending order by their keys, default false.

Drive types

Drive

type Drive struct {}

PutInput

type PutInput struct {
Name string
Body io.Reader
ContentType string
}
FieldTypeDescription
NamestringName of the file to be uploaded.
Bodyio.ReaderFile content to be uploaded.
ContentTypestringContent type of the file. If not provided, Drive tries to figure out the content type from the name. Defaults to application/octet-stream if it can not be determined.

DeleteManyOutput

type DeleteManyOutput struct {
Deleted []string `json:"deleted"`
Failed map[string]string `json:"failed"`
}
FieldTypeDescription
Deleted[]stringNames of the deleted files.
Failedmap[string]stringNames of the files that failed to delete along with an error message.

ListOutput

type ListOutput struct {
Paging *paging `json:"paging"`
Names []string `json:"names"`
}
FieldTypeDescription
Paging*pagingA pointer to a paging struct, nil if there are no further pages.
Names[]stringNames of the files.

paging

type paging struct {
Size int `json:"size"`
Last *string `json:"last"`
}

Indicates the size and last name of the current page.