🚀 Setup Zezo API Client
Install the official Zezo OTT API Client package using your preferred package manager:
pnpm
Terminal
pnpm add @zezosoft/zezo-ott-api-client
After installing the required packages, set up a reusable API client using @zezosoft/zezo-ott-api-client
. This allows you to access endpoints like:
auth.login
auth.signup
categories.get
- and many more.
📦 Create a Client Instance
src/lib/zezoClient.ts
import { ZezoOTT } from "@zezosoft/zezo-ott-api-client";
export const zezoClient = (customHeaders?: Record<string, string>) => {
const headers: Record<string, string> = {
"Content-Type": "application/json",
Accept: "application/json",
...customHeaders,
};
return new ZezoOTT({
baseUrl: process.env.NEXT_PUBLIC_API_BASE_URL || "https://api.zezosoft.com",
withCredentials: true,
headers,
});
};
🛠️ Tip: You can pass custom headers dynamically, such as an Authorization token:
Custom Header Example
zezoClient({ Authorization: `Bearer ${token}` });
🧩 Usage Example
You can now use the API client anywhere in your app or service layer.
✅ TypeScript Example
example.ts
import { ZezoOTT } from "@zezosoft/zezo-ott-api-client";
const zott = new ZezoOTT({ baseUrl: "your-base-url" });
const main = async () => {
const data = await zott.settings.getSettings();
console.log(data);
};
main();
🟨 JavaScript / Node.js Example
example.js
const { ZezoOTT } = require("@zezosoft/zezo-ott-api-client");
const zott = new ZezoOTT({ baseUrl: "your-base-url" });
const main = async () => {
const data = await zott.settings.getSettings();
console.log(data);
};
main();
Last updated on