CheckCourt
TypeScript SDK

Reference

Every export of the TypeScript SDK at a glance

This page lists the exports of @checkcourt/sdk 0.12.0.

@checkcourt/sdk

Client

ExportKindDescription
createCheckCourtClient(options)FunctionTyped client for /api/v1, see Client
unwrap(call)Functiondata or CheckCourtApiError
getInstallation(client)FunctionGET /api/v1/app/installation
getMe(client)FunctionGET /api/v1/me, member tokens only
retryAfterMs(value)FunctionParses Retry-After into milliseconds
TENANT_HEADERConstant"X-Tenant-Id"
CheckCourtClient, CheckCourtClientOptions, RetryOptions, AppInstallation, MeTypes
paths, components, operationsTypesGenerated from the OpenAPI file
OPENAPI_SPEC_SHA256ConstantSHA-256 (hex) of the specification the types were generated from, byte for byte as served by GET /api/v1/openapi

Authentication

ExportKindDescription
apiKeyAuth(key)FunctionAPI key
installationAuth({ clientId, clientSecret, installationId, refreshMarginSeconds? })FunctionCached cca_ tokens; getToken() also returns scopes and expiry
userAuth({ clientId, clientSecret, tokens, onTokens, refreshMarginSeconds? })Functionccu_/ccr_ with rotation; getTokens() and refresh()
AuthStrategy, AuthContext, InstallationAuth, UserAuth, StoredUserTokensTypes

Notifications

ExportKindDescription
sendNotification(client, { recipient, title, body, url?, category?, idempotencyKey? })FunctionPOST /api/v1/app/notifications, see Notifications
NOTIFICATION_TITLE_MAX, NOTIFICATION_BODY_MAXConstants80 and 500
SendNotificationInput, SendNotificationResponseTypes

Connections between apps

ExportKindDescription
getObjectMetadata(client, objectType, id)FunctionGET …/{id}/metadata: your values and those of connected apps
putObjectMetadata(client, objectType, id, key, value)FunctionPUT …/{id}/metadata/{key}
deleteObjectMetadata(client, objectType, id, key)FunctionDELETE …/{id}/metadata/{key}
publishAppEvent(client, { name, data?, subject? })FunctionPOST /api/v1/app/events
ObjectMetadata, ObjectMetadataEntry, ObjectMetadataWritten, PublishAppEventRequest, PublishedAppEventTypes

objectType is "booking", "court" or "member". See Connections between apps.

OAuth (also @checkcourt/sdk/oauth)

ExportKind
createPkcePair, pkceChallenge, createStateFunctions
buildAuthorizeUrl, parseAuthorizeCallbackFunctions
exchangeCode, refreshTokens, revokeToken, fetchInstallationTokenFunctions
postOAuthForm(credentials, path, form)Function, the raw form POST the others use
AUTHORIZE_PATH, TOKEN_PATH, REVOKE_PATH, INSTALLATION_TOKEN_PATHConstants
UserTokenSet, InstallationToken, PkcePair, ClientCredentials, AuthorizeUrlOptions, FetchLikeTypes

Webhooks (also @checkcourt/sdk/webhooks)

ExportKind
verifyWebhook(options), verifySignature(options)Functions
signWebhookPayload(secret, body, timestamp?), isEventType(event, type)Functions
isAppEvent(event, appSlug?, name?), isMetadataChangedEvent(event), appEventType(appSlug, name)Functions for events between apps
SIGNATURE_HEADER, EVENT_ID_HEADER, EVENT_TYPE_HEADER, INSTALLATION_ID_HEADERConstants
DEFAULT_TOLERANCE_SECONDSConstant, 300
EVENT_TYPES, SUBSCRIBABLE_EVENT_TYPES, APP_LIFECYCLE_EVENT_TYPES, METADATA_CHANGED_EVENT_TYPEConstants
WebhookEvent, WebhookEventOf<T>, EventType, EventDataMap, AppEvent, AppMetadataChangedEvent and the …EventData typesTypes

Extensions (also @checkcourt/sdk/extensions)

ExportKind
verifyExtensionContext(token, secret, { now? })Function
verifyExtensionRequest({ secret, rawBody, headers, toleranceSeconds?, now? })Function
ui, toastUI builder
CONTEXT_HEADER, CONTEXT_ISSUER, CONTEXT_TTL_SECONDS, CLOCK_LEEWAY_SECONDS, BOOKING_ACTION_INVOKEConstants
UI_VERSION, MAX_UI_BLOCKS, MAX_UI_DEPTH, BADGE_VARIANTS, BUTTON_VARIANTS, UI_CACHE_MAX_AGE_LIMITConstants
UI_ICONS, STAT_SIZES, ROW_JUSTIFICATIONS, COLUMNS_ALIGNMENTS, MIN_COLUMNS, MAX_COLUMNSConstants for icons, stat, row and columns
ANNOTATION_LABEL_MAX, MAX_ANNOTATIONS_PER_COURT, COLUMN_TITLE_MAX, COLUMN_TEXT_MAX, MAX_APP_COLUMNS, MAX_SIDEBAR_ACTIONS, BOOKING_HINT_TIMEOUT_MS, BOOKING_HINT_BLOCKS, MAX_HINT_BLOCKS, MAX_BOOKING_HINTS, BOOKING_DRAFT_TYPESConstants for the host surfaces
ExtensionContextClaims, ExtensionRequest, ExtensionRenderRequest, ExtensionActionRequest, PointCapabilities, AppPermissionCapabilities, PointSubjectTypes
AnnotationCourt, ColumnMember, BookingDraft, CourtAnnotation, ColumnValue, AnnotationsDocument, ColumnDocument, UiHintDocumentTypes for the host surfaces
UiDocument, UiHiddenDocument, UiResponse, UiBlock, UiFormField, UiFormValues, UiToast, UiCache, UiDocumentOptions, UiIcon, BadgeVariant, StatSize, RowJustify, ColumnsAlignment and the individual block and field typesTypes

Manifest (also @checkcourt/sdk/manifest)

ExportKind
defineManifest(manifest)Function
GRANTABLE_SCOPES, EXTENSION_POINTS, EXTENSION_POINT_SCOPE, INSTALL_TARGETS, USER_LINKING_MODES, EXTENSION_KINDS, MANIFEST_VERSIONConstants
STATIC_ACTION_POINTS, STATIC_ACTION_LABEL_MAX, APP_ACTION_ICONS, IFRAME_EXTENSION_HEIGHT_MIN, IFRAME_EXTENSION_HEIGHT_MAXConstants for static actions, nav.page and iframe heights
MAX_APP_PERMISSIONS, APP_PERMISSION_KEY_PATTERN, APP_PERMISSION_LABEL_MAX, APP_PERMISSION_DESCRIPTION_MAXConstants for permissions
SHARED_OBJECT_TYPES, SHARED_OBJECT_SCOPE, CONNECTION_NAME_PATTERN, MAX_SHARED_VALUE_BYTESConstants for connections
Manifest, ManifestExtension, SettingsSchema, SettingsProperty, DataProcessing, AppPermission, GrantableScope, ExtensionPoint, ExtensionKind, StaticActionPoint, AppActionIconTypes

Errors

CheckCourtError, CheckCourtApiError, OAuthError, TokenRevokedError, AppTemporarilyUnavailableError, WebhookSignatureError, ExtensionVerificationError, isCheckCourtError(err, kind?), oauthErrorFrom(status, body) and the type CheckCourtErrorKind. See Errors and retries.

@checkcourt/sdk/iframe

ExportKind
connectExtensionFrame({ autoResize?, applyTheme? })Function
applyTheme(theme, root?), isThemeMessage(data, channel), isNavigablePath(path)Functions
resizeMessage, toastMessage, navigateMessageFunctions that build messages for your own postMessage calls
CONTEXT_PARAM, CHANNEL_PARAM, NAVIGABLE_SECTIONS, THEME_TOKEN_NAMES, IFRAME_MIN_HEIGHT, IFRAME_MAX_HEIGHT, MAX_TOAST_LENGTHConstants
ExtensionFrame, ConnectOptions, FrameMessage, ThemeMessage, Theme, ThemeTokenNameTypes

On this page