@pagesolver/sdk 2.0.1 → 2.0.3
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 +20 -45
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,10 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Typed TypeScript SDK for the public PageSolver `websites` API.
|
|
4
4
|
|
|
5
|
-
This package is generated from:
|
|
6
|
-
|
|
7
|
-
- [infra/supabase/functions/websites/openapi.json](/Users/zekepari/Documents/GitHub/pagesolver/infra/supabase/functions/websites/openapi.json)
|
|
8
|
-
|
|
9
5
|
## Install
|
|
10
6
|
|
|
11
7
|
```bash
|
|
@@ -25,50 +21,29 @@ const modules = await sdk.getModules();
|
|
|
25
21
|
const showcases = await sdk.getShowcases({ collection: "Bathrooms" });
|
|
26
22
|
```
|
|
27
23
|
|
|
28
|
-
The SDK targets the production PageSolver `websites`
|
|
29
|
-
|
|
30
|
-
Pass `baseUrl` only when you explicitly want a non-production backend, such as local or preview:
|
|
31
|
-
|
|
32
|
-
```ts
|
|
33
|
-
const sdk = createClient({
|
|
34
|
-
businessKey: process.env.PAGESOLVER_BUSINESS_KEY!,
|
|
35
|
-
baseUrl: "https://your-preview-project.supabase.co/functions/v1/websites",
|
|
36
|
-
});
|
|
37
|
-
```
|
|
38
|
-
|
|
39
|
-
## Regenerate
|
|
24
|
+
The SDK targets the production PageSolver `websites` API by default.
|
|
40
25
|
|
|
41
|
-
|
|
42
|
-
bun run sdk:generate
|
|
43
|
-
```
|
|
44
|
-
|
|
45
|
-
The SDK contract version is synced from:
|
|
26
|
+
## API
|
|
46
27
|
|
|
47
|
-
-
|
|
28
|
+
- `getModules()`
|
|
29
|
+
- `getShowcases({ collection? })`
|
|
30
|
+
- `getComparisons({ collection? })`
|
|
31
|
+
- `getReviews()`
|
|
32
|
+
- `getFacebook()`
|
|
33
|
+
- `submitContact(payload)`
|
|
48
34
|
|
|
49
|
-
|
|
35
|
+
## Errors
|
|
50
36
|
|
|
51
|
-
|
|
37
|
+
Non-2xx responses throw `PageSolverApiError`.
|
|
52
38
|
|
|
53
|
-
```
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
## Publish
|
|
64
|
-
|
|
65
|
-
```bash
|
|
66
|
-
bun run sdk:publish
|
|
67
|
-
```
|
|
68
|
-
|
|
69
|
-
For prereleases or alternate npm tags:
|
|
70
|
-
|
|
71
|
-
```bash
|
|
72
|
-
cd packages/sdk
|
|
73
|
-
bun publish --access public --tag next
|
|
39
|
+
```ts
|
|
40
|
+
import { PageSolverApiError } from "@pagesolver/sdk";
|
|
41
|
+
|
|
42
|
+
try {
|
|
43
|
+
await sdk.getModules();
|
|
44
|
+
} catch (error) {
|
|
45
|
+
if (error instanceof PageSolverApiError) {
|
|
46
|
+
console.error(error.status, error.data);
|
|
47
|
+
}
|
|
48
|
+
}
|
|
74
49
|
```
|