# npm install @karmared/api
or
# yarn add @karmared/api
If you know email and password:
import Karma from "@karmared/api"
const EMAIL = "example@mail.com", PASSWORD = "...";
const karma = await Karma.login(EMAIL, PASSWORD)
or if you know bearer token:
import Karma from "@karmared/api"
const BEARER_TOKEN = "..."
const karma = new Karma({token: BEARER_TOKEN})
You can see all requests on site https://my.karma.red/graphql.
const query = `
{
viewer {
id
}
}`
const response = await karma.request(query)
console.log(response) // {data: {viewer: {id: "..."}}}