function

createClient

function createClient<Config extends RiduConfigShape = RiduConfigShape>( options: ClientOptions, ): RiduClient<Config>

Create a typed client from a Ridu base URL and transport options.

Source packages/sdk/src/index.ts:1

@param options
Base URL and optional Fetch, headers, credentials, and middleware.
@returns
A client whose slugs and payloads come from Config.

Import the generated client module once to register its config, or pass its config type explicitly when a TypeScript program contains multiple Ridu applications.

Methods return ordinary Promise values. Non-2xx responses and malformed success envelopes reject with RiduError.

Example

ts
import "~/generated/ridu.generated";
import { createClient } from "@riducms/sdk";

const cms = createClient({ baseURL: "https://cms.example.com" });
const posts = await cms.list("posts", {
  limit: 20,
  sort: ["-publishedAt"],
});

Related types

  • RiduConfigShape

    The minimum generated contract shape consumed by the SDK.

  • ClientOptions

    Transport and middleware options for createClient.

  • RiduClient

    The complete typed REST client for schema, auth, access, content, uploads, versions, globals, preview, and preferences.