@picked/admin-api-client 0.0.1-dev.1789541668638 → 0.0.1-dev.1793756239746
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 +1 -0
- package/README.md +40 -14
- package/dist/.tsbuildinfo +1 -1
- package/dist/cjs/graphql.js +1 -0
- package/dist/cjs/index.js +79 -2
- package/dist/esm/graphql.js +5 -0
- package/dist/esm/index.js +34 -18
- package/dist/types/client.d.ts +35 -2
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/graphql-env.d.ts +263 -46
- package/dist/types/index.d.ts +3 -2
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/workspace-transfer.d.ts +170 -0
- package/dist/types/workspace-transfer.d.ts.map +1 -0
- package/package.json +17 -4
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
|
-
|
|
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'
|
|
9
16
|
|
|
10
|
-
const MeQuery = graphql(`
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
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
|
-
|
|
17
|
-
|
|
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
|
-
|
|
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
|
-
|
|
44
|
+
The package also exports the documents that move a workspace between projects, such as
|
|
45
|
+
`WorkspaceExportDocument` and `WorkspaceImportDocument`.
|
|
22
46
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
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.
|