sCStorage

sCStorage

The sCStorage instance communicates with the storage API.

Constructor

new sCStorage(app_id, app_secret, service_urlopt)

Opens a new schmuckliCloud storage instance. It can be used to manage then all the data in a defined project.

Parameters:
Name Type Attributes Description
app_id String

The APP ID, which was created for a client app in the schmuckliCloud console.

app_secret String

The APP Secret, which was created for a client app in the schmuckliCloud console.

service_url String <optional>

If you want to replace the backend url instead of https://api.schmuckli.cloud/client_api/v1/data/, provide here the new path.

Source:

Classes

sCStorage

Methods

setDataset(dataset_name)

Set the dataset, which should be used for the further data operations.

Parameters:
Name Type Description
dataset_name String

The name of the dataset (Do not use the id)

Source:

setAuthToken(auth_token, not_resetopt)

Binds the authentication token to the storage object, to use the protected dataset, reserved for the user.

Parameters:
Name Type Attributes Description
auth_token string

The authentication session token from the auth library.

not_reset boolean <optional>

By default, it will reset the dataset. If you want to use the authentication dataset, you must provide a empty dataset string.

Source:

setSharePassword(password)

When you plan to use the future requests with a given share password, assign first this password here and call later the requests as usual.

Parameters:
Name Type Description
password string

The clear password, which should be used.

Source:

setBucket(bucket_id)

Set the bucket id which later should be used to manage data.

Parameters:
Name Type Description
bucket_id Number

The number of the bucket id

Source:

getAll(container_name, sortingopt, startopt, limitopt, excludeopt) → {Promise.<sCResult>}

This method lets you retrieve all rows from a container.

Parameters:
Name Type Attributes Description
container_name String

The container name, created via the schmuckliCloud console

sorting String | Array | Object <optional>

Sort the entries ascending ('asc' by default) or descending ('desc').

start Number <optional>

Define a start index.

limit Number <optional>

Define a maximum of showing results.

exclude Array <optional>

Columns, which should be excluded from the results.

Source:

get(container_name, filter, sortingopt, startopt, limitopt, excludeopt, filter_connectopt) → {Promise.<sCResult>}

This method lets you retrieve data with filters.

Parameters:
Name Type Attributes Description
container_name String

The container name, created via the schmuckliCloud console

filter Array

A filter is an array, defining which entries should be displayed.

sorting String <optional>

Sort the entries ascending ('asc' by default) or descending ('desc').

start Number <optional>

Define a start index.

limit Number <optional>

Define a maximum of showing results.

exclude Array <optional>

Columns, which should be excluded from the results.

filter_connect String <optional>

Sets the connection between the filters. (Default: OR)

Source:

count(container_name, filter, filter_connectopt) → {Promise.<sCResult>}

This method returns the amount of data rows with/out filter.

Parameters:
Name Type Attributes Description
container_name String

The container name, created via the schmuckliCloud console

filter Array

A filter is an array, defining which entries should be displayed.

filter_connect String <optional>

Sets the connection between the filters. (Default: OR)

Source:

sum(container_name, filter, field_name, filter_connectopt) → {Promise.<sCResult>}

This method returns the SUM of field with/out filter.

Parameters:
Name Type Attributes Description
container_name String

The container name, created via the schmuckliCloud console

filter Array

A filter is an array, defining which entries should be displayed.

field_name String

The name of the field, which should be used for the result.

filter_connect String <optional>

Sets the connection between the filters. (Default: OR)

Source:

avg(container_name, filter, field_name, filter_connectopt) → {Promise.<sCResult>}

This method returns the AVG of field with/out filter.

Parameters:
Name Type Attributes Description
container_name String

The container name, created via the schmuckliCloud console

filter Array

A filter is an array, defining which entries should be displayed.

field_name String

The name of the field, which should be used for the result.

filter_connect String <optional>

Sets the connection between the filters. (Default: OR)

Source:

Creates a share link with the containing rows.

Parameters:
Name Type Attributes Description
container_name String

The container name, where the rows are located.

rows Array

The row id's, which should be shared via a link.

password string <optional>

Sets a password. Leave blank, if you want don't want to set a password.

expire string <optional>

Sets a expire date. Leave blank, if you want don't want to set a expire date. The link will then be available for an unlimited time.

Source:

Updates an existing share with rows, password and/or expire date.

Parameters:
Name Type Attributes Description
container_name string

The name of the container, where the rows are stored.

share_id number

The id of the share, which should be updated.

new_rows array

The ids of the new rows, which should be added.

remove_rows array

The ids of the existing rows, which should be removed.

password string <optional>

Sets a new password. Leave blank, if you want to keep the current password.

expire string <optional>

Sets a new expire date. Leave blank, if you want to keep the current expire date.

custom_link string <optional>

Sets an alias (custom link) for the share, that it can be accessed via that.

Source:

Returns the already shared links by the currently signed in user.

Source:

Deletes an existing share link from the currently signed in account.

Parameters:
Name Type Description
share_id Number

The id of the share link, which should be deleted.

Source:

getById(container_name, row_id, exclude) → {Promise.<sCResult>}

Retrieve a single rowset by it's id.

Parameters:
Name Type Description
container_name String

The container name, where the ID is contained.

row_id Number

The row id, which can be trieved by get or getAll.

exclude Array

Columns, which should be excluded from the results.

Source:

insert(container_name, data) → {Promise.<sCResult>}

This methdod can add new rows to you container in the previous set dataset.

Parameters:
Name Type Description
container_name String

The container name, created via the schmuckliCloud console

data String

A dataobject with a key-value pair. The key represents the columns defined in the schmuckliCloud console.

Source:

update(container_name, row_id, data) → {Promise.<sCResult>}

This method updates a specific row in a container

Parameters:
Name Type Description
container_name String

Define a container name, which should be updated.

row_id Number

Define a row id which should be updated

data Object

Define the data object in a key-value pair

Source:

delete(container_name, row_id, column) → {Promise.<sCResult>}

This method deletes a specific row in a container or can just delete a column in a specific row.

Parameters:
Name Type Description
container_name String

Define the container name, where the deletion process should take place

row_id Number

Define a row id, which can be retrieved by the 'get' or 'getAll' method.

column String

Define a column name, when just this data in this specific column should be deleted.

Source:

metadata(container_name) → {Promise.<sCResult>}

Fetches the metadata of the given container name.

Parameters:
Name Type Description
container_name String

The container name

Source: