Skip to content
This repository has been archived by the owner on Jun 16, 2022. It is now read-only.

Latest commit

 

History

History
103 lines (70 loc) · 1.61 KB

environment.md

File metadata and controls

103 lines (70 loc) · 1.61 KB

Environment

Create a new environment

import { ARK } from "@payvo/sdk-ark";
import { Environment } from "@payvo/profiles";
import { Request } from "@payvo/sdk-http-bent";

new Environment({
    coins: { ARK },
    httpClient: new Request(),
    storage: "localstorage"
});

Profiles

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

Fill the profile using the provided data

env.profiles().fill(profileData);

Get a list of all profiles

env.profiles().all();

Get the first stored profile

env.profiles().first();

Get the last stored profile

env.profiles().last();

Get all associated profile keys

env.profiles().keys();

Get all associated profile values

env.profiles().values();

Find the profile for the given Id

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

Find the profile for the given name

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

Create a new profile for the given name

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

Check if a data for the given key exists

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

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

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

Forget all profile data (Use with caution!)

env.profiles().flush();

Get the count of stored profiles

env.profiles().count();

Get the profile as a data Object

env.profiles().toObject();