@askeladden/booking-sdk
v1.26.0
Published
## Overview
Downloads
54
Readme
Booking SDK Documentation
Overview
The Booking SDK allows you to interact with the Booking Hasura GraphQL API seamlessly. This SDK is split into server-side and client-side implementations, enabling easy integration based on your needs.
Installation
Install the SDK via npm:
npm install @askeladden/booking-sdk
Setup
Server SDK
The server SDK can be set up with the following parameters:
| Parameter | Type | Required | Default | Description |
| ----------------- | ------- | -------- | ------------------------------------------------- | ---------------------------------------------------- |
| organizationId
| string | Yes | - | Your organization ID. |
| url
| string | No | https://booking-hasura.askeladden.co/v1/graphql
| The GraphQL API endpoint URL. |
| trackingEnabled
| boolean | No | false
| Enable tracking by including cookies in the request. |
import { getServerSdk } from '@askeladden/booking-sdk/server';
const serverSdk = getServerSdk({
organizationId: 'your-organization-id',
trackingEnabled: true,
});
// Example usage: CreateBookableEventRegistration
await serverSdk.CreateBookableEventRegistration({
object: {
// ...details
},
});
API Client SDK
The API client SDK provides additional functions and requires OAuth2 authentication. You can generate API clients on booking.askeladden.co
under settings.
| Parameter | Type | Required | Default | Description |
| ---------------- | ------ | -------- | ------------------------------------------------- | ------------------------------ |
| organizationId
| string | Yes | - | Your organization ID. |
| url
| string | No | https://booking-hasura.askeladden.co/v1/graphql
| The GraphQL API endpoint URL. |
| clientId
| string | Yes | - | Your client ID for OAuth2. |
| clientSecret
| string | Yes | - | Your client secret for OAuth2. |
import { getApiClientSdk } from '@askeladden/booking-sdk/server';
const apiClientSdk = getApiClientSdk({
organizationId: 'your-organization-id',
clientId: 'your-client-id',
clientSecret: 'your-client-secret',
});
const result = await apiClientSdk.SomeQuery({
// ...details
});
Client SDK
The client SDK can be set up with the following parameters:
| Parameter | Type | Required | Default | Description |
| ----------------- | ------- | -------- | ------------------------------------------------- | ---------------------------------------------------- |
| organizationId
| string | Yes | - | Your organization ID. |
| url
| string | No | https://booking-hasura.askeladden.co/v1/graphql
| The GraphQL API endpoint URL. |
| trackingEnabled
| boolean | No | false
| Enable tracking by including cookies in the request. |
import { getClientSdk } from '@askeladden/booking-sdk/client';
const clientSdk = getClientSdk({
organizationId: 'your-organization-id',
trackingEnabled: true,
});
// Example usage: CreateBookingRequest
await clientSdk.CreateBookingRequest({
object: {
// ...details
},
});