TypeScript SDK
Reference
Every export of the TypeScript SDK at a glance
This page lists the exports of @checkcourt/sdk 0.12.0.
| Export | Kind | Description |
|---|
createCheckCourtClient(options) | Function | Typed client for /api/v1, see Client |
unwrap(call) | Function | data or CheckCourtApiError |
getInstallation(client) | Function | GET /api/v1/app/installation |
getMe(client) | Function | GET /api/v1/me, member tokens only |
retryAfterMs(value) | Function | Parses Retry-After into milliseconds |
TENANT_HEADER | Constant | "X-Tenant-Id" |
CheckCourtClient, CheckCourtClientOptions, RetryOptions, AppInstallation, Me | Types | |
paths, components, operations | Types | Generated from the OpenAPI file |
OPENAPI_SPEC_SHA256 | Constant | SHA-256 (hex) of the specification the types were generated from, byte for byte as served by GET /api/v1/openapi |
| Export | Kind | Description |
|---|
apiKeyAuth(key) | Function | API key |
installationAuth({ clientId, clientSecret, installationId, refreshMarginSeconds? }) | Function | Cached cca_ tokens; getToken() also returns scopes and expiry |
userAuth({ clientId, clientSecret, tokens, onTokens, refreshMarginSeconds? }) | Function | ccu_/ccr_ with rotation; getTokens() and refresh() |
AuthStrategy, AuthContext, InstallationAuth, UserAuth, StoredUserTokens | Types | |
| Export | Kind | Description |
|---|
sendNotification(client, { recipient, title, body, url?, category?, idempotencyKey? }) | Function | POST /api/v1/app/notifications, see Notifications |
NOTIFICATION_TITLE_MAX, NOTIFICATION_BODY_MAX | Constants | 80 and 500 |
SendNotificationInput, SendNotificationResponse | Types | |
| Export | Kind | Description |
|---|
getObjectMetadata(client, objectType, id) | Function | GET …/{id}/metadata: your values and those of connected apps |
putObjectMetadata(client, objectType, id, key, value) | Function | PUT …/{id}/metadata/{key} |
deleteObjectMetadata(client, objectType, id, key) | Function | DELETE …/{id}/metadata/{key} |
publishAppEvent(client, { name, data?, subject? }) | Function | POST /api/v1/app/events |
ObjectMetadata, ObjectMetadataEntry, ObjectMetadataWritten, PublishAppEventRequest, PublishedAppEvent | Types | |
objectType is "booking", "court" or "member". See
Connections between apps.
| Export | Kind |
|---|
createPkcePair, pkceChallenge, createState | Functions |
buildAuthorizeUrl, parseAuthorizeCallback | Functions |
exchangeCode, refreshTokens, revokeToken, fetchInstallationToken | Functions |
postOAuthForm(credentials, path, form) | Function, the raw form POST the others use |
AUTHORIZE_PATH, TOKEN_PATH, REVOKE_PATH, INSTALLATION_TOKEN_PATH | Constants |
UserTokenSet, InstallationToken, PkcePair, ClientCredentials, AuthorizeUrlOptions, FetchLike | Types |
| Export | Kind |
|---|
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_HEADER | Constants |
DEFAULT_TOLERANCE_SECONDS | Constant, 300 |
EVENT_TYPES, SUBSCRIBABLE_EVENT_TYPES, APP_LIFECYCLE_EVENT_TYPES, METADATA_CHANGED_EVENT_TYPE | Constants |
WebhookEvent, WebhookEventOf<T>, EventType, EventDataMap, AppEvent, AppMetadataChangedEvent and the …EventData types | Types |
| Export | Kind |
|---|
verifyExtensionContext(token, secret, { now? }) | Function |
verifyExtensionRequest({ secret, rawBody, headers, toleranceSeconds?, now? }) | Function |
ui, toast | UI builder |
CONTEXT_HEADER, CONTEXT_ISSUER, CONTEXT_TTL_SECONDS, CLOCK_LEEWAY_SECONDS, BOOKING_ACTION_INVOKE | Constants |
UI_VERSION, MAX_UI_BLOCKS, MAX_UI_DEPTH, BADGE_VARIANTS, BUTTON_VARIANTS, UI_CACHE_MAX_AGE_LIMIT | Constants |
UI_ICONS, STAT_SIZES, ROW_JUSTIFICATIONS, COLUMNS_ALIGNMENTS, MIN_COLUMNS, MAX_COLUMNS | Constants 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_TYPES | Constants for the host surfaces |
ExtensionContextClaims, ExtensionRequest, ExtensionRenderRequest, ExtensionActionRequest, PointCapabilities, AppPermissionCapabilities, PointSubject | Types |
AnnotationCourt, ColumnMember, BookingDraft, CourtAnnotation, ColumnValue, AnnotationsDocument, ColumnDocument, UiHintDocument | Types for the host surfaces |
UiDocument, UiHiddenDocument, UiResponse, UiBlock, UiFormField, UiFormValues, UiToast, UiCache, UiDocumentOptions, UiIcon, BadgeVariant, StatSize, RowJustify, ColumnsAlignment and the individual block and field types | Types |
| Export | Kind |
|---|
defineManifest(manifest) | Function |
GRANTABLE_SCOPES, EXTENSION_POINTS, EXTENSION_POINT_SCOPE, INSTALL_TARGETS, USER_LINKING_MODES, EXTENSION_KINDS, MANIFEST_VERSION | Constants |
STATIC_ACTION_POINTS, STATIC_ACTION_LABEL_MAX, APP_ACTION_ICONS, IFRAME_EXTENSION_HEIGHT_MIN, IFRAME_EXTENSION_HEIGHT_MAX | Constants for static actions, nav.page and iframe heights |
MAX_APP_PERMISSIONS, APP_PERMISSION_KEY_PATTERN, APP_PERMISSION_LABEL_MAX, APP_PERMISSION_DESCRIPTION_MAX | Constants for permissions |
SHARED_OBJECT_TYPES, SHARED_OBJECT_SCOPE, CONNECTION_NAME_PATTERN, MAX_SHARED_VALUE_BYTES | Constants for connections |
Manifest, ManifestExtension, SettingsSchema, SettingsProperty, DataProcessing, AppPermission, GrantableScope, ExtensionPoint, ExtensionKind, StaticActionPoint, AppActionIcon | Types |
CheckCourtError, CheckCourtApiError, OAuthError, TokenRevokedError,
AppTemporarilyUnavailableError, WebhookSignatureError, ExtensionVerificationError,
isCheckCourtError(err, kind?), oauthErrorFrom(status, body) and the type
CheckCourtErrorKind. See Errors and retries.
| Export | Kind |
|---|
connectExtensionFrame({ autoResize?, applyTheme? }) | Function |
applyTheme(theme, root?), isThemeMessage(data, channel), isNavigablePath(path) | Functions |
resizeMessage, toastMessage, navigateMessage | Functions 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_LENGTH | Constants |
ExtensionFrame, ConnectOptions, FrameMessage, ThemeMessage, Theme, ThemeTokenName | Types |