@platform/sdk-template
Typed client foundation used by the generated service SDK packages. It provides the shared createServiceClient() factory and the generic HTTP methods that the service-specific SDKs narrow with their paths types.
Installation
npm install @platform/sdk-templateYou’ll also need the shared auth/client helpers:
npm install @platform/hosts @platform/sdkQuick start
import type { paths } from "@platform/sdk-identity";
import { createServiceClient } from "@platform/sdk-template";
const client = createServiceClient<paths>({
baseUrl: "https://identity.dev.platform.loop.health",
accessToken: process.env.LOOP_ACCESS_TOKEN!,
});Service SDK packages such as @platform/sdk-identity wrap this factory so you usually do not need @platform/sdk-template directly unless you are building a new generated SDK or experimenting with a raw typed client.
Public API
createServiceClient
Underlying REST endpoint: (not detected from source)
Parameters
options: ServiceClientOptions
Return type
Client<TPaths>Example
import type { paths } from "@platform/sdk-identity";
import { createServiceClient } from "@platform/sdk-template";
const client = createServiceClient<paths>({
baseUrl: "https://identity.dev.platform.loop.health",
accessToken: process.env.LOOP_ACCESS_TOKEN!,
});GET
Underlying REST endpoint: (not detected from source)
Parameters
path: stringinit?: Record<string, unknown>
Return type
Promise<{
data?: unknown;
error?: unknown;
response: Response;
}>Example
const result = await client.GET("/v1/example", {
/* typed request options */
});POST
Underlying REST endpoint: (not detected from source)
Parameters
path: stringinit?: Record<string, unknown>
Return type
Promise<{
data?: unknown;
error?: unknown;
response: Response;
}>Example
const result = await client.POST("/v1/example", {
/* typed request options */
});PUT
Underlying REST endpoint: (not detected from source)
Parameters
path: stringinit?: Record<string, unknown>
Return type
Promise<{
data?: unknown;
error?: unknown;
response: Response;
}>Example
const result = await client.PUT("/v1/example", {
/* typed request options */
});PATCH
Underlying REST endpoint: (not detected from source)
Parameters
path: stringinit?: Record<string, unknown>
Return type
Promise<{
data?: unknown;
error?: unknown;
response: Response;
}>Example
const result = await client.PATCH("/v1/example", {
/* typed request options */
});DELETE
Underlying REST endpoint: (not detected from source)
Parameters
path: stringinit?: Record<string, unknown>
Return type
Promise<{
data?: unknown;
error?: unknown;
response: Response;
}>Example
const result = await client.DELETE("/v1/example", {
/* typed request options */
});