@nixopus/api-client 0.0.2 → 0.0.4

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 CHANGED
@@ -10,11 +10,17 @@ npm install @nixopus/api-client @hey-api/client-fetch
10
10
  yarn add @nixopus/api-client @hey-api/client-fetch
11
11
  ```
12
12
 
13
+ For Zod schema validation install `zod` as well:
14
+
15
+ ```bash
16
+ npm install @nixopus/api-client @hey-api/client-fetch zod
17
+ ```
18
+
13
19
  ## Usage
14
20
 
15
21
  ```typescript
16
22
  import { createClient } from '@hey-api/client-fetch';
17
- import { getApplications, getDeployments } from '@nixopus/api-client';
23
+ import { getApiV1DeployApplications, getApiV1DeployApplicationDeployments } from '@nixopus/api-client';
18
24
 
19
25
  const client = createClient({
20
26
  baseUrl: 'https://api.nixopus.com',
@@ -27,25 +33,23 @@ const client = createClient({
27
33
  });
28
34
 
29
35
  // Use the generated SDK functions
30
- const applications = await getApplications({ client });
31
- const deployments = await getDeployments({ client });
36
+ const applications = await getApiV1DeployApplications({ client });
37
+ const deployments = await getApiV1DeployApplicationDeployments({ client });
38
+ ```
39
+
40
+ ### Zod schemas
41
+
42
+ The package exports generated Zod schemas for request/response validation.
43
+
44
+ ```typescript
45
+ import { z } from 'zod';
46
+ import { zPostApiV1DeployApplicationData, zPostApiV1DeployApplicationRestartData } from '@nixopus/api-client';
47
+
48
+ // Request schemas include .shape.body, .shape.query, .shape.path for body/query/path params
49
+ const deployBodySchema = zPostApiV1DeployApplicationData.shape.body ?? z.object({});
50
+ const restartBodySchema = zPostApiV1DeployApplicationRestartData.shape.body ?? z.object({});
32
51
  ```
33
52
 
34
53
  ## Sync
35
54
 
36
55
  This package is automatically regenerated and published when the OpenAPI spec changes in the [nixopus](https://github.com/raghavyuva/nixopus) repository.
37
-
38
- ## Setup
39
-
40
- 1. Create a new repo `nixopus/api-client` on GitHub (or use existing)
41
- 2. Push this folder:
42
- ```bash
43
- cd nixopus-api-client
44
- git init
45
- git add .
46
- git commit -m "Initial commit"
47
- git remote add origin https://github.com/nixopus/api-client.git
48
- git push -u origin master
49
- ```
50
- 3. Add secrets to the **nixopus** repo: `API_CLIENT_REPO_TOKEN` (GitHub PAT with `repo` scope)
51
- 4. Add secrets to the **api-client** repo: `NPM_TOKEN` (from npmjs.com)