@alyvro/api-service 1.3.0 → 1.3.1

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 +13 -3
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -131,8 +131,18 @@ Define your API schema once and get full auto-completion and type inference for
131
131
  import { ApiService } from "@alyvro/api-service";
132
132
 
133
133
  type ApiSchema = {
134
- "/users": { id: number; name: string }[];
135
- "/auth/login": { token: string };
134
+ "/users": {
135
+ GET: {
136
+ response: { id: number; name: string }[];
137
+ params: { page: number };
138
+ };
139
+ };
140
+ "/auth/login": {
141
+ POST: {
142
+ body: { username: string };
143
+ response: { token: string };
144
+ };
145
+ };
136
146
  };
137
147
 
138
148
  const api = new ApiService({
@@ -145,7 +155,7 @@ api.post("/auth/login", { username: "admin" }).then((res) => {
145
155
  });
146
156
 
147
157
  // ✅ TypeScript knows this returns Array<{ id: number; name: string }>
148
- api.get("/users").then((res) => {
158
+ api.get("/users", { params: { page: 1 } }).then((res) => {
149
159
  console.log(res.data[0].name);
150
160
  });
151
161
  ```
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@alyvro/api-service",
3
- "version": "1.3.0",
3
+ "version": "1.3.1",
4
4
  "description": "A minimal yet powerful service for sending HTTP requests on the client and handling them gracefully on the server. No complicated setup. Just plug in your keys — and you're ready to go.",
5
5
  "types": "./dist/index.d.ts",
6
6
  "main": "./dist/index.js",