@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.
- package/README.md +73 -25
- 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
|
|
4
|
-
|
|
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
|
-
|
|
7
|
+
```bash
|
|
8
|
+
npm install @waldofyi/sdk
|
|
9
|
+
```
|
|
7
10
|
|
|
8
|
-
|
|
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
|
-
```
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
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
|
-
|
|
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
|
-
##
|
|
46
|
+
## Responses
|
|
21
47
|
|
|
22
|
-
`
|
|
23
|
-
`
|
|
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
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
33
|
-
`packages/cli/src/sdk/` (hand-written, GraphQL + REST).
|
|
83
|
+
## License
|
|
34
84
|
|
|
35
|
-
|
|
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).
|