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
NotFoundError - When there is an entity not found error in the response
ValidationError - When there are invalid fields
ServerError - When the request fails
Resources
Available with Storefront Access
carts
get carts(): Carts
Cart methods
Returns
plans
get plans(): Plans
Plan methods
Example
const plans = await client.plans.fetchAll();
Returns
products
get products(): Products
Product methods
Example
const products = await client.products.fetchAll();
Returns
selfServiceCenterToken
get selfServiceCenterToken(): SelfServiceCenterToken
SelfServiceCenterToken methods
Returns
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
Was this helpful?