FirmhouseClient

Client for accessing Firmhouse GraphQL api

Example

import { FirmhouseClient, Access } from '@firmhouse/sdk';
const client = new FirmhouseClient({
 apiToken,
 accessType: Access.write
});

const cart = await client.carts.getOrCreate();
const products = await client.products.fetchAll();
const invoices = await client.invoices.fetchAll();

Type parameters

TAccess extends Access = storefront

Access type. (Will be inferred from the config)

Methods

rawRequest()

rawRequest(graphQLQuery, variables?): Promise<unknown>

Sends an authenticated raw request to API. This can be used for custom field selections or bulk queries/mutations.

Parameters

graphQLQuery: string

The GraphQL query

variables?: Record<string, unknown>

Variables to use in query

Returns

Promise<unknown>

The response from the API

Throws

Resources

Available with Storefront Access

carts

get carts(): Carts

Cart methods

Returns

Carts


plans

get plans(): Plans

Plan methods

Example

const plans = await client.plans.fetchAll();

Returns

Plans


products

get products(): Products

Product methods

Example

const products = await client.products.fetchAll();

Returns

Products


selfServiceCenterToken

get selfServiceCenterToken(): SelfServiceCenterToken

SelfServiceCenterToken methods

Returns

SelfServiceCenterToken

Only Available with Write Access

invoices

get invoices(): TAccess extends write ? Invoices : never

Invoice methods

Returns

TAccess extends write ? [invoices-resource]../resources/(invoices.md) : never


projects

get projects(): TAccess extends write ? Projects : never

Project methods

Returns

TAccess extends write ? [projects-resource]../resources/(projects.md) : never


subscriptions

get subscriptions(): TAccess extends write ? Subscriptions : never

Subscription methods.

Returns

TAccess extends write ? [subscriptions-resource]../resources/(subscriptions.md) : never

Last updated