Skip to content

Getting started ​

The SDK talks to the Noviqa gateway: the staff side (/admin/v1, administrators and managers, the CRM) and the trader side (/trader/v1), over REST and one live socket.

Install ​

bash
# no account or token needed
npm install https://crm-docs.noviqa.com/sdk/hybrid-solutions-09-noviqa-sdk-0.1.0.tgz
bash
# .npmrc next to your package.json:
#   @hybrid-solutions-09:registry=https://npm.pkg.github.com
#   //npm.pkg.github.com/:_authToken=${GITHUB_TOKEN}
export GITHUB_TOKEN=ghp_your_token   # a token with read:packages; never commit it
npm install @hybrid-solutions-09/noviqa-sdk

Either way you import it as @hybrid-solutions-09/noviqa-sdk. Pin the versioned file: each release gets its own URL, and https://crm-docs.noviqa.com/sdk/noviqa-sdk-latest.tgz always points to the newest.

Inside the backend repository, build it from source instead: cd sdk/js && npm ci && npm run check.

Create the client ​

There is one class per side: Staff for the CRM and back office (admin and manager terminals), Trader for trading terminals.

ts
import { Staff } from "@hybrid-solutions-09/noviqa-sdk"

// Cookies carry the session; the SDK adds the CSRF header to every change.
export const staff = new Staff({
  baseUrl: import.meta.env.VITE_API_URL, // "" = same origin
  auth: { type: "session" },
})
ts
import { Trader } from "@hybrid-solutions-09/noviqa-sdk"

export const trader = new Trader({
  baseUrl: import.meta.env.VITE_API_URL,
  auth: { type: "session" },
})
ts
import { Staff, Trader } from "@hybrid-solutions-09/noviqa-sdk"

// Bearer tokens, kept in memory by default. deviceId: stable per installation.
export const staff = new Staff({ baseUrl: "https://api.example.com", auth: { type: "jwt" }, deviceId: "install-7f3c" })
export const trader = new Trader({ baseUrl: "https://api.example.com", auth: { type: "jwt" }, deviceId: "install-7f3c" })

First calls ​

ts
await staff.auth.login({ login: 1000, password, terminal: "admin" })   // or "manager"

const page = await staff.accounts.list()
console.log(page.total, page.items[0]?.login)

const client = await staff.clients.retrieve(42)

Every method returns the answer's data and throws an NoviqaError on failure. Method names follow one pattern:

CallMethod
GET /admin/v1/clientsstaff.clients.list(query)
GET /admin/v1/clients/{id}staff.clients.retrieve(id)
POST /admin/v1/clientsstaff.clients.create(body)
PUT / PATCH /admin/v1/clients/{id}staff.clients.update(id, body)
DELETE /admin/v1/clients/{id}staff.clients.delete(id)
POST /admin/v1/clients/{id}/approvestaff.clients.approve(id, body)

Arguments come in this order: path parameters, then the body, then the query, then options ({ headers, signal }). Look up any method in the reference.

Call anything by path ​

The typed low-level client is there for anything you prefer to call by path:

ts
const data = await staff.client.request("get", "/admin/v1/accounts/{login}", { path: { login: 1001 } })