@fill-easy/api 1.0.7 → 1.0.9
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 +7 -8
- package/dist/index.d.ts +7 -1
- package/dist/index.js +10 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,6 +4,8 @@ Type-safe SDK for Fill Easy API, generated from OpenAPI specification.
|
|
|
4
4
|
|
|
5
5
|
Read full docs here: https://fill-easy.gitbook.io/fill-easy-docs
|
|
6
6
|
|
|
7
|
+
Made with https://openapi-ts.dev/
|
|
8
|
+
|
|
7
9
|
## Installation
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -15,7 +17,11 @@ npm install @fill-easy/api
|
|
|
15
17
|
```typescript
|
|
16
18
|
import { createApiClient } from "@fill-easy/api"
|
|
17
19
|
|
|
18
|
-
const client = createApiClient(
|
|
20
|
+
const client = createApiClient({
|
|
21
|
+
baseUrl: "https://sandbox.staging-api.fill-easy.com",
|
|
22
|
+
clientId: "your-client-id",
|
|
23
|
+
clientSecret: "your-client-secret",
|
|
24
|
+
})
|
|
19
25
|
|
|
20
26
|
// Fully typed API calls
|
|
21
27
|
const { data, error } = await client.POST("/iamsmart/v2/request/auth", {
|
|
@@ -31,10 +37,3 @@ if (error) {
|
|
|
31
37
|
console.log(data)
|
|
32
38
|
}
|
|
33
39
|
```
|
|
34
|
-
|
|
35
|
-
## Features
|
|
36
|
-
|
|
37
|
-
- ✅ Fully type-safe with TypeScript
|
|
38
|
-
- ✅ Auto-completion for all API endpoints
|
|
39
|
-
- ✅ Lightweight - uses native fetch API
|
|
40
|
-
- ✅ Generated from OpenAPI specification
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,10 @@
|
|
|
1
1
|
import type { paths } from "./openapi.d.ts";
|
|
2
2
|
export type { paths };
|
|
3
|
-
export
|
|
3
|
+
export interface ApiClientConfig {
|
|
4
|
+
baseUrl: string;
|
|
5
|
+
clientId: string;
|
|
6
|
+
clientSecret: string;
|
|
7
|
+
headers?: HeadersInit;
|
|
8
|
+
}
|
|
9
|
+
export declare function createApiClient(config: ApiClientConfig): import("openapi-fetch").Client<paths, `${string}/${string}`>;
|
|
4
10
|
export default createApiClient;
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,13 @@
|
|
|
1
|
-
/* global
|
|
1
|
+
/* global HeadersInit */
|
|
2
2
|
import createClient from "openapi-fetch";
|
|
3
|
-
export function createApiClient(
|
|
4
|
-
return createClient({
|
|
3
|
+
export function createApiClient(config) {
|
|
4
|
+
return createClient({
|
|
5
|
+
baseUrl: config.baseUrl,
|
|
6
|
+
headers: {
|
|
7
|
+
"x-client-id": config.clientId,
|
|
8
|
+
"x-client-secret": config.clientSecret,
|
|
9
|
+
...config.headers,
|
|
10
|
+
},
|
|
11
|
+
});
|
|
5
12
|
}
|
|
6
13
|
export default createApiClient;
|