> ## Documentation Index
> Fetch the complete documentation index at: https://api.zglosscammera.pl/llms.txt
> Use this file to discover all available pages before exploring further.

# JavaScript / TypeScript

> Typowany klient API dla przeglądarki i Node.js.

Klient działa w przeglądarce (CORS jest otwarty) i w Node.js 18+.

```ts zglos-scammera.ts theme={null}
const BASE_URL = "https://zglosscammera.pl";

export type ListKind = "scammers" | "servers" | "legit";

export type ListEntry = {
  _id: string;
  name: string;
  id: string;
  descHtml: string;
  verified: boolean;
  proofsId: string | null;
  reportId: string;
};

export type ListResponse = {
  data: ListEntry[];
  total: number;
  hasMore: boolean;
};

export type ListParams = {
  search?: string;
  id?: string;
  sort?: "newest" | "oldest" | "popular" | "popular_asc" | "az" | "za";
  status?: "all" | "verified" | "risk";
  proofs?: "all" | "with" | "private";
  skip?: number;
  limit?: number;
};

async function request<T>(path: string): Promise<T> {
  const res = await fetch(`${BASE_URL}${path}`);
  if (!res.ok) {
    const body = await res.json().catch(() => ({}));
    throw new Error(body.error ?? `HTTP ${res.status}`);
  }
  return res.json() as Promise<T>;
}

export function getList(kind: ListKind, params: ListParams = {}) {
  const query = new URLSearchParams(
    Object.entries(params)
      .filter(([, value]) => value !== undefined)
      .map(([key, value]) => [key, String(value)]),
  );
  return request<ListResponse>(`/api/${kind}?${query}`);
}

export function check(query: string) {
  return request<{ results: { kind: ListKind; entries: ListEntry[] }[] }>(
    `/api/check?q=${encodeURIComponent(query)}`,
  );
}
```

## Użycie

```ts theme={null}
import { check, getList } from "./zglos-scammera";

const { results } = await check("1478133625840074918");
const isScammer = results.some((result) => result.kind !== "legit");

const page = await getList("scammers", {
  status: "verified",
  proofs: "with",
  limit: 60,
});
console.log(`${page.total} zweryfikowanych oszustów z dowodami`);
```


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.