Skip to content

Commit b3a42f3

Browse files
committed
u
1 parent 793ffb8 commit b3a42f3

File tree

3 files changed

+110
-13
lines changed

3 files changed

+110
-13
lines changed

.github/workflows/publish-types.yml

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -63,22 +63,9 @@ jobs:
6363
cd landscape-types
6464
pnpm pkg set version="$VERSION"
6565
66-
- name: Verify npm token
67-
run: |
68-
if [ -z "$NPM_TOKEN" ]; then
69-
echo "::error::NPM_TOKEN secret is empty!"
70-
exit 1
71-
fi
72-
echo "Token starts with: ${NPM_TOKEN:0:8}..."
73-
env:
74-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
75-
7666
- name: Publish to npm
7767
run: |
7868
echo "//registry.npmjs.org/:_authToken=${NODE_AUTH_TOKEN}" > ~/.npmrc
79-
cat ~/.npmrc | head -c 50
80-
echo "..."
81-
npm whoami --registry https://registry.npmjs.org || echo "whoami failed"
8269
pnpm --filter @landscape-router/types publish --no-git-checks --access public
8370
env:
8471
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

landscape-types/README.md

Lines changed: 95 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,95 @@
1+
# @landscape-router/types
2+
3+
TypeScript API client and type definitions for [Landscape Router](https://github.com/ThisSeanZhang/landscape), auto-generated from OpenAPI spec via [orval](https://orval.dev/).
4+
5+
## Install
6+
7+
```bash
8+
npm install @landscape-router/types
9+
# or
10+
pnpm add @landscape-router/types
11+
```
12+
13+
Requires `axios` as a peer dependency:
14+
15+
```bash
16+
npm install axios
17+
```
18+
19+
## Usage
20+
21+
### 1. Configure axios instance
22+
23+
Before calling any API function, you must set up the axios instance:
24+
25+
```ts
26+
import axios from "axios";
27+
import { setAxiosInstance } from "@landscape-router/types/mutator";
28+
29+
const instance = axios.create({
30+
baseURL: "https://your-landscape-router:6443",
31+
timeout: 30000,
32+
});
33+
34+
setAxiosInstance(instance);
35+
```
36+
37+
### 2. Call API functions
38+
39+
```ts
40+
import { getFlowRules } from "@landscape-router/types/api/flow-rules/flow-rules";
41+
import { getDnsRule } from "@landscape-router/types/api/dns-rules/dns-rules";
42+
43+
// Fetch all flow rules
44+
const flows = await getFlowRules();
45+
46+
// Fetch a specific DNS rule
47+
const rule = await getDnsRule("my-rule-id");
48+
```
49+
50+
### 3. Use type definitions
51+
52+
```ts
53+
import type { FlowConfig, DnsUpstreamConfig } from "@landscape-router/types/api/schemas";
54+
```
55+
56+
## Available API Modules
57+
58+
| Module | Import Path |
59+
|--------|-------------|
60+
| Auth | `@landscape-router/types/api/auth/auth` |
61+
| DNS Rules | `@landscape-router/types/api/dns-rules/dns-rules` |
62+
| DNS Redirects | `@landscape-router/types/api/dns-redirects/dns-redirects` |
63+
| DNS Service | `@landscape-router/types/api/dns-service/dns-service` |
64+
| DNS Upstreams | `@landscape-router/types/api/dns-upstreams/dns-upstreams` |
65+
| DHCPv4 | `@landscape-router/types/api/dhcpv4/dhcpv4` |
66+
| Docker | `@landscape-router/types/api/docker/docker` |
67+
| Docker Images | `@landscape-router/types/api/docker-images/docker-images` |
68+
| Docker Networks | `@landscape-router/types/api/docker-networks/docker-networks` |
69+
| Enrolled Devices | `@landscape-router/types/api/enrolled-devices/enrolled-devices` |
70+
| Firewall Blacklists | `@landscape-router/types/api/firewall-blacklists/firewall-blacklists` |
71+
| Firewall Service | `@landscape-router/types/api/firewall-service/firewall-service` |
72+
| Flow Rules | `@landscape-router/types/api/flow-rules/flow-rules` |
73+
| Geo IPs | `@landscape-router/types/api/geo-ips/geo-ips` |
74+
| Geo Sites | `@landscape-router/types/api/geo-sites/geo-sites` |
75+
| ICMPv6 RA | `@landscape-router/types/api/icmpv6-ra/icmpv6-ra` |
76+
| Interfaces | `@landscape-router/types/api/interfaces/interfaces` |
77+
| IP Config | `@landscape-router/types/api/ip-config/ip-config` |
78+
| IPv6 PD | `@landscape-router/types/api/ipv6-pd/ipv6-pd` |
79+
| Metric | `@landscape-router/types/api/metric/metric` |
80+
| MSS Clamp | `@landscape-router/types/api/mss-clamp/mss-clamp` |
81+
| NAT Service | `@landscape-router/types/api/nat-service/nat-service` |
82+
| PPPoE | `@landscape-router/types/api/pppo-e/pppo-e` |
83+
| Route | `@landscape-router/types/api/route/route` |
84+
| Route LAN | `@landscape-router/types/api/route-lan/route-lan` |
85+
| Route WAN | `@landscape-router/types/api/route-wan/route-wan` |
86+
| Static NAT Mappings | `@landscape-router/types/api/static-nat-mappings/static-nat-mappings` |
87+
| System Config | `@landscape-router/types/api/system-config/system-config` |
88+
| System Info | `@landscape-router/types/api/system-info/system-info` |
89+
| Wi-Fi | `@landscape-router/types/api/wi-fi/wi-fi` |
90+
| Destination IP Rules | `@landscape-router/types/api/destination-ip-rules/destination-ip-rules` |
91+
| Schemas (types only) | `@landscape-router/types/api/schemas` |
92+
93+
## License
94+
95+
[MIT](https://github.com/ThisSeanZhang/landscape/blob/main/LICENSE)

landscape-types/package.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,22 @@
11
{
22
"name": "@landscape-router/types",
33
"version": "0.13.1",
4+
"description": "TypeScript API client and type definitions for Landscape Router, auto-generated from OpenAPI spec.",
45
"type": "module",
6+
"license": "MIT",
7+
"repository": {
8+
"type": "git",
9+
"url": "https://github.com/ThisSeanZhang/landscape.git",
10+
"directory": "landscape-types"
11+
},
12+
"homepage": "https://github.com/ThisSeanZhang/landscape",
13+
"keywords": [
14+
"landscape",
15+
"router",
16+
"api-client",
17+
"openapi",
18+
"typescript"
19+
],
520
"exports": {
621
"./*": "./src/*"
722
},

0 commit comments

Comments
 (0)