@picked/admin-api-client 0.0.101-next.2 → 0.0.101-next.3

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.
Files changed (2) hide show
  1. package/README.md +30 -23
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -1,8 +1,15 @@
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'
@@ -16,30 +23,30 @@ const MeQuery = graphql(`
16
23
  }
17
24
  `)
18
25
 
19
- const client = createAdminApiClient({ apiUrl: 'https://api.picked.app', token: accessToken })
20
- const data = await client.request(MeQuery, {}) // fully typed from the schema
21
- ```
26
+ const client = createAdminApiClient({
27
+ apiUrl: 'https://api.picked.app',
28
+ apiKey: process.env.PICKED_API_KEY,
29
+ })
22
30
 
23
- Documents are authored with `graphql`; results and variables are inferred from the API schema. The
24
- client trusts the API response (no runtime shape validation), matching the dashboard's transport.
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
- A request is aborted after 30 seconds; `client.request(document, variables, { timeoutMs })`
29
- sets a different limit for one request. When the API answers with GraphQL errors, `request`
30
- throws an `AdminApiResponseError` whose `codes` holds each error's `extensions.code`; a
31
- network failure, timeout, or HTTP error without a GraphQL error list throws a plain `Error`.
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
- The package also exports the documents that move a workspace between projects:
34
- `WorkspaceExportDocument`, `ProjectLiveVersionDocument`, `WorkspaceImportDocument`,
35
- `AssetUploadInitDocument`, `AssetCommitDocument`, `AssetDeleteDocument` and
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
- ## Development
44
+ The package also exports the documents that move a workspace between projects, such as
45
+ `WorkspaceExportDocument` and `WorkspaceImportDocument`.
39
46
 
40
- Regenerate the schema types after the API schema changes:
47
+ ## Docs
41
48
 
42
- ```bash
43
- pnpm --filter=api codegen # writes apps/api/.cache/merged-schema.graphql
44
- pnpm --filter=@picked/admin-api-client codegen # regenerates src/graphql-env.d.ts
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
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@picked/admin-api-client",
3
3
  "description": "Typed gql.tada client for the Picked admin (management) GraphQL API",
4
- "version": "0.0.101-next.2",
4
+ "version": "0.0.101-next.3",
5
5
  "dependencies": {
6
6
  "@0no-co/graphql.web": "^1.2.0",
7
7
  "gql.tada": "^1.11.3",