Environment

Create a new environment

1import { ARK } from "@ardenthq/sdk-ark";
2import { Environment } from "@ardenthq/sdk-profiles";
3import { Request } from "@ardenthq/sdk-fetch";
4 
5new Environment({
6 coins: { ARK },
7 httpClient: new Request(),
8 storage: "localstorage"
9});

Profiles

Information

These methods are accessible through env.profiles() which exposes a ProfileRepository instance.

Fill the profile using the provided data

1env.profiles().fill(profileData);

Get a list of all profiles

1env.profiles().all();

Get the first stored profile

1env.profiles().first();

Get the last stored profile

1env.profiles().last();

Get all associated profile keys

1env.profiles().keys();

Get all associated profile values

1env.profiles().values();

Find the profile for the given Id

1env.profiles().findById("uuid");

Find the profile for the given name

1env.profiles().findByName("John Doe");

Create a new profile for the given name

1env.profiles().create("John Doe");

Check if a data for the given key exists

1env.profiles().has(jane.id());

Forget the profile for the given Id (Use with caution!)

1env.profiles().forget("uuid");

Forget all profile data (Use with caution!)

1env.profiles().flush();

Get the count of stored profiles

1env.profiles().count();

Get the profile as a data Object

1env.profiles().toObject();
Last updated 2 years ago
Edit Page
Share: