@picked/admin-api-client 0.0.101-next.2 → 0.0.101
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.
- package/README.md +30 -23
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,8 +1,15 @@
|
|
|
1
1
|
# @picked/admin-api-client
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
A typed GraphQL client for the Picked Management API: results and variables are inferred from
|
|
4
|
+
the schema.
|
|
4
5
|
|
|
5
|
-
##
|
|
6
|
+
## Install
|
|
7
|
+
|
|
8
|
+
```bash
|
|
9
|
+
npm install @picked/admin-api-client
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
## Usage
|
|
6
13
|
|
|
7
14
|
```typescript
|
|
8
15
|
import { createAdminApiClient, graphql } from '@picked/admin-api-client'
|
|
@@ -16,30 +23,30 @@ const MeQuery = graphql(`
|
|
|
16
23
|
}
|
|
17
24
|
`)
|
|
18
25
|
|
|
19
|
-
const client = createAdminApiClient({
|
|
20
|
-
|
|
21
|
-
|
|
26
|
+
const client = createAdminApiClient({
|
|
27
|
+
apiUrl: 'https://api.picked.app',
|
|
28
|
+
apiKey: process.env.PICKED_API_KEY,
|
|
29
|
+
})
|
|
22
30
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
Pass `apiKey` to authenticate with an API key; the client sends it as the `X-API-Key` header.
|
|
31
|
+
const data = await client.request(MeQuery, {})
|
|
32
|
+
```
|
|
27
33
|
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
34
|
+
| Option | Description |
|
|
35
|
+
| -------- | ---------------------------------------------------------------- |
|
|
36
|
+
| `apiUrl` | The Picked API origin. |
|
|
37
|
+
| `token` | A bearer token, or a function that returns one for each request. |
|
|
38
|
+
| `apiKey` | An API key, sent as `X-API-Key`. |
|
|
32
39
|
|
|
33
|
-
|
|
34
|
-
`
|
|
35
|
-
|
|
36
|
-
`WorkspacePublishDocument`.
|
|
40
|
+
A request times out after 30 seconds; `client.request(document, variables, { timeoutMs })`
|
|
41
|
+
changes that. GraphQL errors throw an `AdminApiResponseError` whose `codes` holds each
|
|
42
|
+
error's `extensions.code`; other failures throw an `Error`.
|
|
37
43
|
|
|
38
|
-
|
|
44
|
+
The package also exports the documents that move a workspace between projects, such as
|
|
45
|
+
`WorkspaceExportDocument` and `WorkspaceImportDocument`.
|
|
39
46
|
|
|
40
|
-
|
|
47
|
+
## Docs
|
|
41
48
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
49
|
+
- **Web:** [Management API client](https://docs.picked.app/reference/tools/admin-api-client)
|
|
50
|
+
- **Local:** `node_modules/picked/docs/reference/tools/admin-api-client.md`. The `picked` package carries every page under `node_modules/picked/docs/`.
|
|
51
|
+
- **CLI:** `npx picked docs read /reference/tools/admin-api-client`. `npx picked docs list [words]` lists the pages.
|
|
52
|
+
- **MCP:** call `read_picked_doc` with `{ "path": "/reference/tools/admin-api-client" }`; `list_picked_docs` lists the pages. Add the server with `claude mcp add --transport http picked https://api.picked.app/mcp`, or see [How to connect the MCP server](https://docs.picked.app/how-to/connect-the-mcp-server) for other tools.
|
package/package.json
CHANGED