@picked/admin-api-client 0.0.1-dev.1788925875333 → 0.0.1-dev.1793753513002

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/LICENSE ADDED
@@ -0,0 +1 @@
1
+ Copyright (c) Picked. All rights reserved. Contact Picked for a usage licence.
package/README.md CHANGED
@@ -1,26 +1,52 @@
1
1
  # @picked/admin-api-client
2
2
 
3
- Typed [gql.tada](https://gql.tada.dev) client for the Picked admin (management) GraphQL API.
3
+ A typed GraphQL client for the Picked Management API: results and variables are inferred from
4
+ the schema.
4
5
 
5
- ## API
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'
9
16
 
10
- const MeQuery = graphql(`query Me { user { id email } }`)
11
-
12
- const client = createAdminApiClient({ apiUrl: 'https://api.picked.app', token: accessToken })
13
- const data = await client.request(MeQuery, {}) // fully typed from the schema
17
+ const MeQuery = graphql(`
18
+ query Me {
19
+ user {
20
+ id
21
+ email
22
+ }
23
+ }
24
+ `)
25
+
26
+ const client = createAdminApiClient({
27
+ apiUrl: 'https://api.picked.app',
28
+ apiKey: process.env.PICKED_API_KEY,
29
+ })
30
+
31
+ const data = await client.request(MeQuery, {})
14
32
  ```
15
33
 
16
- Documents are authored with `graphql`; results and variables are inferred from the API schema. The
17
- client trusts the API response (no runtime shape validation), matching the dashboard's transport.
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`. |
18
39
 
19
- ## Development
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`.
20
43
 
21
- Regenerate the schema types after the API schema changes:
44
+ The package also exports the documents that move a workspace between projects, such as
45
+ `WorkspaceExportDocument` and `WorkspaceImportDocument`.
22
46
 
23
- ```bash
24
- pnpm --filter=api codegen # writes apps/api/.cache/merged-schema.graphql
25
- pnpm --filter=@picked/admin-api-client codegen # regenerates src/graphql-env.d.ts
26
- ```
47
+ ## Docs
48
+
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.