@waldofyi/sdk 0.1.0 → 0.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of @waldofyi/sdk might be problematic. Click here for more details.

Files changed (2) hide show
  1. package/README.md +73 -25
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,37 +1,85 @@
1
1
  # @waldofyi/sdk
2
2
 
3
- Official TypeScript SDK for the **public** Waldo API. Generated from the OpenAPI
4
- spec with [hey-api](https://heyapi.dev) do not hand-edit `src/`.
3
+ Official TypeScript SDK for the [Waldo](https://data.waldo.fyi/v1/docs) public API
4
+ brand intelligence, social discovery, and enrichment across every major
5
+ platform. Fully typed, generated from Waldo's OpenAPI spec.
5
6
 
6
- ## Regenerate
7
+ ```bash
8
+ npm install @waldofyi/sdk
9
+ ```
7
10
 
8
- The OpenAPI input (`openapi.json`) is built **locally from this repo's own REST
9
- app** — not fetched from a deployed URL — so the SDK always matches the code
10
- being shipped (no drift, no deploy dependency).
11
+ ## Quick start
11
12
 
12
- ```bash
13
- pnpm --filter @waldo/graphql-api gen:sdk-spec # rebuild the committed openapi.json
14
- pnpm --filter @waldofyi/sdk codegen # generate src/ from openapi.json
15
- pnpm --filter @waldofyi/sdk build # compile to dist/
13
+ ```ts
14
+ import { client, brandSearch, brandOwnedMediaSummary } from "@waldofyi/sdk";
15
+
16
+ // Configure once. The base URL defaults to https://data.waldo.fyi.
17
+ client.setConfig({
18
+ headers: { Authorization: `Bearer ${process.env.WALDO_API_KEY}` },
19
+ });
20
+
21
+ // Find a brand, then pull its owned-media summary.
22
+ const { data: search } = await brandSearch({ query: { q: "Gatorade" } });
23
+ const brand = search?.data?.[0];
24
+
25
+ const { data: owned } = await brandOwnedMediaSummary({
26
+ path: { brand_id: brand.id },
27
+ query: { window: "30d" },
28
+ });
29
+
30
+ console.log(brand.name, owned?.data);
16
31
  ```
17
32
 
18
- `codegen` + `build` also run automatically via `prepublishOnly`.
33
+ ## Authentication
34
+
35
+ Every request needs a Waldo API key as a bearer token. Create one in the Waldo
36
+ app under **Settings → API Keys**, then set it on the client (as above) or
37
+ per-call:
38
+
39
+ ```ts
40
+ await brandSearch({
41
+ query: { q: "Nike" },
42
+ headers: { Authorization: `Bearer ${apiKey}` },
43
+ });
44
+ ```
19
45
 
20
- ## What's in / out
46
+ ## Responses
21
47
 
22
- `gen:sdk-spec` builds the spec for the public SDK flag set (see
23
- `packages/api/scripts/gen-sdk-spec.ts`). Admin/platform routes are excluded;
24
- brand-intelligence routes are **included** (v0.1.0). The server's feature-flag
25
- exposure system stays the single source of truth for what's public — the
26
- generator only picks the flag set.
48
+ Each call resolves to `{ data, error }` no exceptions thrown for HTTP errors.
49
+ `data` is the response envelope; list endpoints page with a cursor:
27
50
 
28
- Method names come from each route's `operationId`, which the API emits from the
29
- operation registry's `operationName` (`packages/api/src/rest/lib/operation-route.ts`)
30
- and stamps onto the spec in `buildFilteredOpenApiSpec`.
51
+ ```ts
52
+ const { data, error } = await brandMentionsList({
53
+ path: { brand_id },
54
+ query: { limit: 50, cursor },
55
+ });
56
+
57
+ if (error) { /* handle it */ }
58
+ for (const mention of data.data) { /* ... */ }
59
+ const next = data.meta.next_cursor; // pass back as `cursor` for the next page
60
+ ```
61
+
62
+ ## What's available
63
+
64
+ - **Brands** — search, overview, owned/paid/earned media, mentions, platforms,
65
+ timeseries, and competitive comparison (`brand*`)
66
+ - **Discovery** — posts, ads, companies, communities, users, and trends across
67
+ platforms (`discover*`)
68
+ - **Enrichment** — profiles, posts, companies, and video transcripts
69
+ (`enrichment*`)
70
+
71
+ Method names map to the API's operations; every request and response is typed.
72
+ Full interactive reference: **https://data.waldo.fyi/v1/docs**
73
+
74
+ ## Base URL
75
+
76
+ Defaults to production (`https://data.waldo.fyi`). Override for a non-prod
77
+ stage:
78
+
79
+ ```ts
80
+ client.setConfig({ baseUrl: "https://rest-staging.development.waldo.fyi" });
81
+ ```
31
82
 
32
- The internal, admin-capable client used by the CLI lives at
33
- `packages/cli/src/sdk/` (hand-written, GraphQL + REST).
83
+ ## License
34
84
 
35
- > Generated `src/*.gen.ts` is not committed (gitignored) — it's produced fresh
36
- > from the committed `openapi.json` at codegen/publish. Only `openapi.json` and
37
- > the placeholder `src/index.ts` are committed.
85
+ MIT. Generated with [hey-api](https://heyapi.dev).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@waldofyi/sdk",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Official TypeScript SDK for the Waldo public API — generated from the OpenAPI spec",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",