@garagem-ai/site-sdk 0.1.0
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 +163 -0
- package/dist/index.d.mts +325 -0
- package/dist/index.d.ts +325 -0
- package/dist/index.js +236 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +204 -0
- package/dist/index.mjs.map +1 -0
- package/package.json +46 -0
- package/src/client.ts +145 -0
- package/src/fetchers.ts +244 -0
- package/src/index.ts +55 -0
- package/src/internal/url.ts +32 -0
- package/src/types.ts +194 -0
package/README.md
ADDED
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
# `@garagem-ai/site-sdk`
|
|
2
|
+
|
|
3
|
+
Typed, runtime-agnostic SDK for building custom real estate sites against the
|
|
4
|
+
Garagem platform.
|
|
5
|
+
|
|
6
|
+
> **Status:** v0.1.0 alpha — workspace-internal. The public npm release is
|
|
7
|
+
> tracked in the Garagem Sites SDK rollout plan.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
pnpm add @garagem-ai/site-sdk
|
|
13
|
+
# or: npm install @garagem-ai/site-sdk
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
## Quickstart
|
|
17
|
+
|
|
18
|
+
### Bare functions (simple)
|
|
19
|
+
|
|
20
|
+
```ts
|
|
21
|
+
import { getListings } from "@garagem-ai/site-sdk";
|
|
22
|
+
|
|
23
|
+
const { listings, total } = await getListings({
|
|
24
|
+
siteId: "abc-123",
|
|
25
|
+
filters: { city: "São Paulo", limit: 24 },
|
|
26
|
+
next: { revalidate: 300, tags: ["site:abc-123:listings"] },
|
|
27
|
+
});
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Bound client (binds defaults)
|
|
31
|
+
|
|
32
|
+
```ts
|
|
33
|
+
import { createGaragemClient } from "@garagem-ai/site-sdk";
|
|
34
|
+
|
|
35
|
+
export const garagem = createGaragemClient({
|
|
36
|
+
siteId: "abc-123",
|
|
37
|
+
next: { revalidate: 300 },
|
|
38
|
+
});
|
|
39
|
+
|
|
40
|
+
// Anywhere in your app:
|
|
41
|
+
const { listings } = await garagem.getListings({ filters: { city: "RJ" } });
|
|
42
|
+
const detail = await garagem.getListing({ listingId: "xyz" });
|
|
43
|
+
const site = await garagem.getSite({ domain: "imobiliariax.com.br" });
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
## What you get in v0.1
|
|
47
|
+
|
|
48
|
+
The SDK ships two layers — a friendly default for 90% of cases, plus a
|
|
49
|
+
raw escape hatch when you need full control.
|
|
50
|
+
|
|
51
|
+
### Friendly layer (recommended for most use cases)
|
|
52
|
+
|
|
53
|
+
| API | Description |
|
|
54
|
+
| --- | --- |
|
|
55
|
+
| `getListings({ siteId, filters?, next? })` | Paginated listings for a site, with simple `filters` (`city`, `businessType`, `propertyType`, `neighborhood`, `minPrice`, `maxPrice`, `limit`, `offset`) |
|
|
56
|
+
| `getListing({ siteId, listingId, next? })` | Full detail of a single listing |
|
|
57
|
+
| `getSite({ siteId? \| domain?, next? })` | Public site profile (returns `null` if unknown) |
|
|
58
|
+
|
|
59
|
+
### Advanced layer (when the friendly one isn't enough)
|
|
60
|
+
|
|
61
|
+
| API | Description |
|
|
62
|
+
| --- | --- |
|
|
63
|
+
| `searchListings({ siteId, params, next? })` | Direct passthrough to the underlying search engine — full param set, raw response (`hits[].document`, `highlight`, `text_match`, etc.). Use for faceted search, multi-field sort, custom grouping. |
|
|
64
|
+
|
|
65
|
+
### Cross-cutting
|
|
66
|
+
|
|
67
|
+
| API | Description |
|
|
68
|
+
| --- | --- |
|
|
69
|
+
| `createGaragemClient(options)` | Pre-bind `baseUrl`, `siteId`, `fetch`, `next` |
|
|
70
|
+
| `GaragemSdkError` | Thrown on non-2xx responses; carries `status` + `url` |
|
|
71
|
+
|
|
72
|
+
All fetchers accept:
|
|
73
|
+
|
|
74
|
+
- `baseUrl` — defaults to `https://app.garagem.ai`. Override for a custom proxy or staging.
|
|
75
|
+
- `fetch` — custom fetch implementation (testing, retries, edge runtimes).
|
|
76
|
+
- `next: { revalidate, tags }` — forwarded directly to the underlying `fetch` for Next.js App Router caching. Ignored on runtimes that don't understand it.
|
|
77
|
+
|
|
78
|
+
## App Router example (friendly API)
|
|
79
|
+
|
|
80
|
+
```tsx
|
|
81
|
+
// app/imoveis/page.tsx
|
|
82
|
+
import { getListings } from "@garagem-ai/site-sdk";
|
|
83
|
+
|
|
84
|
+
export default async function Page() {
|
|
85
|
+
const { listings } = await getListings({
|
|
86
|
+
siteId: process.env.GARAGEM_SITE_ID!,
|
|
87
|
+
filters: { businessType: "sale", limit: 24 },
|
|
88
|
+
next: { revalidate: 300, tags: ["listings"] },
|
|
89
|
+
});
|
|
90
|
+
|
|
91
|
+
return (
|
|
92
|
+
<ul>
|
|
93
|
+
{listings.map((l) => (
|
|
94
|
+
<li key={l.id}>{l.title}</li>
|
|
95
|
+
))}
|
|
96
|
+
</ul>
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
To revalidate when a listing changes, hit `revalidateTag("listings")` from your
|
|
102
|
+
webhook handler.
|
|
103
|
+
|
|
104
|
+
## Advanced example (raw search)
|
|
105
|
+
|
|
106
|
+
`searchListings` exposes the underlying search engine directly. Use
|
|
107
|
+
when the friendly `filters` shape isn't expressive enough.
|
|
108
|
+
|
|
109
|
+
```tsx
|
|
110
|
+
// app/buscar/page.tsx
|
|
111
|
+
import { searchListings } from "@garagem-ai/site-sdk";
|
|
112
|
+
|
|
113
|
+
export default async function Page({ searchParams }: { searchParams: { q?: string } }) {
|
|
114
|
+
const result = await searchListings({
|
|
115
|
+
siteId: process.env.GARAGEM_SITE_ID!,
|
|
116
|
+
params: {
|
|
117
|
+
q: searchParams.q ?? "*",
|
|
118
|
+
query_by: "title,description,neighborhood",
|
|
119
|
+
filter_by: "businessType:=sale && bedrooms:>=2",
|
|
120
|
+
sort_by: "price:asc",
|
|
121
|
+
facet_by: "neighborhood,propertyType",
|
|
122
|
+
per_page: 24,
|
|
123
|
+
page: 1,
|
|
124
|
+
},
|
|
125
|
+
next: { revalidate: 60 },
|
|
126
|
+
});
|
|
127
|
+
|
|
128
|
+
return (
|
|
129
|
+
<>
|
|
130
|
+
<p>{result.found} results in {result.search_time_ms}ms</p>
|
|
131
|
+
<ul>
|
|
132
|
+
{result.hits.map((hit, i) => (
|
|
133
|
+
<li key={i}>{String(hit.document.title)}</li>
|
|
134
|
+
))}
|
|
135
|
+
</ul>
|
|
136
|
+
</>
|
|
137
|
+
);
|
|
138
|
+
}
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
## Runtimes
|
|
142
|
+
|
|
143
|
+
Works wherever `fetch` is available:
|
|
144
|
+
|
|
145
|
+
- Node 18+ (and Next.js server / route handlers)
|
|
146
|
+
- Edge runtime (Vercel Edge, Cloudflare Workers, Deno)
|
|
147
|
+
- Browsers (use carefully — see "Public keys" below)
|
|
148
|
+
|
|
149
|
+
## Public keys & rate limiting (roadmap)
|
|
150
|
+
|
|
151
|
+
Today every fetcher is anonymous. As the SDK approaches public launch we'll
|
|
152
|
+
add **publishable keys** with per-tenant rate limits and a domain allowlist —
|
|
153
|
+
no breaking changes to the call sites, just an additional `publishableKey`
|
|
154
|
+
option on `createGaragemClient`.
|
|
155
|
+
|
|
156
|
+
## What's NOT in v0.1
|
|
157
|
+
|
|
158
|
+
- CMS endpoints (collections / entries) — coming in v0.2.
|
|
159
|
+
- Typesense / InstantSearch helpers — coming as separate `@garagem-ai/site-sdk/search` subpath.
|
|
160
|
+
- React hooks (`useListings`, `useSearch`, …) — coming as `@garagem-ai/site-sdk/react` subpath.
|
|
161
|
+
- LiveSession / lead submission helpers.
|
|
162
|
+
|
|
163
|
+
All of these will land additively; the v0.1 surface above will not break.
|
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,325 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Public types for the Garagem Sites SDK.
|
|
3
|
+
*
|
|
4
|
+
* These match the canonical shapes returned by the public Garagem
|
|
5
|
+
* Sites API (`/api/sites/...`). Treat them as the public contract —
|
|
6
|
+
* additive changes only, never breaking.
|
|
7
|
+
*/
|
|
8
|
+
/** Sale/rental indicator. The API may return additional string values; consumers should branch defensively. */
|
|
9
|
+
type ListingBusinessType = "sale" | "rental" | (string & {});
|
|
10
|
+
/** Whether the price is shown publicly or kept on request. */
|
|
11
|
+
type ListingPriceVisibility = "public" | "private";
|
|
12
|
+
/** Property-level fields shown on a listing summary card. */
|
|
13
|
+
interface ListingPropertySummary {
|
|
14
|
+
type: string;
|
|
15
|
+
bedrooms: number;
|
|
16
|
+
bathrooms: number;
|
|
17
|
+
suites: number;
|
|
18
|
+
parkingSpaces: number;
|
|
19
|
+
totalArea: number;
|
|
20
|
+
usableArea: number;
|
|
21
|
+
}
|
|
22
|
+
/** Address breakdown returned with every listing. */
|
|
23
|
+
interface ListingLocation {
|
|
24
|
+
street: string;
|
|
25
|
+
number: string;
|
|
26
|
+
complement?: string;
|
|
27
|
+
neighborhood: string;
|
|
28
|
+
city: string;
|
|
29
|
+
state: string;
|
|
30
|
+
postalCode: string;
|
|
31
|
+
country?: string;
|
|
32
|
+
coordinates?: {
|
|
33
|
+
lat: number;
|
|
34
|
+
lng: number;
|
|
35
|
+
} | null;
|
|
36
|
+
}
|
|
37
|
+
/** Single media item attached to a listing (image, video, floor plan, …). */
|
|
38
|
+
interface ListingMedia {
|
|
39
|
+
id: string;
|
|
40
|
+
type: string;
|
|
41
|
+
category: string;
|
|
42
|
+
src: string;
|
|
43
|
+
alt?: string;
|
|
44
|
+
caption?: string;
|
|
45
|
+
order?: number;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Minimum information needed to render a listing on a grid or card.
|
|
49
|
+
* Returned by `getListings`.
|
|
50
|
+
*
|
|
51
|
+
* `price` is `null` when the listing's `priceVisibility` is `"private"`
|
|
52
|
+
* (i.e. the price is hidden behind an explicit lead request) or when
|
|
53
|
+
* the underlying record has no price set. Always branch on `price ==
|
|
54
|
+
* null` rather than `!price` so genuine `0` values (rare but legal in
|
|
55
|
+
* promotional flows) don't get masked as "sob consulta".
|
|
56
|
+
*/
|
|
57
|
+
interface Listing {
|
|
58
|
+
id: string;
|
|
59
|
+
title: string;
|
|
60
|
+
description: string;
|
|
61
|
+
businessType: ListingBusinessType;
|
|
62
|
+
price: number | null;
|
|
63
|
+
priceVisibility: ListingPriceVisibility;
|
|
64
|
+
status: string;
|
|
65
|
+
featured: boolean;
|
|
66
|
+
property: ListingPropertySummary;
|
|
67
|
+
location: ListingLocation;
|
|
68
|
+
coverImage?: {
|
|
69
|
+
src: string;
|
|
70
|
+
alt: string;
|
|
71
|
+
} | null;
|
|
72
|
+
createdAt: string;
|
|
73
|
+
updatedAt: string;
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Full listing data including amenities, full media gallery, building
|
|
77
|
+
* details and richer property info. Returned by `getListing`.
|
|
78
|
+
*/
|
|
79
|
+
interface ListingDetail extends Listing {
|
|
80
|
+
amenities: string[];
|
|
81
|
+
tags: string[];
|
|
82
|
+
property: ListingPropertySummary & {
|
|
83
|
+
id: string;
|
|
84
|
+
builtArea?: number;
|
|
85
|
+
landArea?: number;
|
|
86
|
+
floor?: number;
|
|
87
|
+
totalFloors?: number;
|
|
88
|
+
yearBuilt?: number;
|
|
89
|
+
furnished?: boolean;
|
|
90
|
+
petFriendly?: boolean;
|
|
91
|
+
};
|
|
92
|
+
building?: {
|
|
93
|
+
name: string;
|
|
94
|
+
amenities: string[];
|
|
95
|
+
elevators?: number;
|
|
96
|
+
unitsPerFloor?: number;
|
|
97
|
+
totalUnits?: number;
|
|
98
|
+
} | null;
|
|
99
|
+
media: ListingMedia[];
|
|
100
|
+
}
|
|
101
|
+
/** Filter / pagination options for `getListings`. */
|
|
102
|
+
interface ListingFilters {
|
|
103
|
+
limit?: number;
|
|
104
|
+
offset?: number;
|
|
105
|
+
businessType?: ListingBusinessType;
|
|
106
|
+
propertyType?: string;
|
|
107
|
+
city?: string;
|
|
108
|
+
neighborhood?: string;
|
|
109
|
+
minPrice?: number;
|
|
110
|
+
maxPrice?: number;
|
|
111
|
+
}
|
|
112
|
+
/** Wrapped response from `getListings`. */
|
|
113
|
+
interface ListingsResult {
|
|
114
|
+
listings: Listing[];
|
|
115
|
+
total: number;
|
|
116
|
+
/** Echo of the `limit` query param actually applied (subject to a 100-item cap). */
|
|
117
|
+
limit?: number;
|
|
118
|
+
/** Echo of the `offset` query param actually applied. */
|
|
119
|
+
offset?: number;
|
|
120
|
+
}
|
|
121
|
+
/**
|
|
122
|
+
* Raw Typesense search parameters accepted by `searchListings`. Mirrors
|
|
123
|
+
* the same body the underlying `/api/sites/{siteId}/search` endpoint
|
|
124
|
+
* forwards to Typesense (`q`, `query_by`, `filter_by`, `sort_by`,
|
|
125
|
+
* `per_page`, `page`, facets, etc.) — see the Typesense docs at
|
|
126
|
+
* https://typesense.org/docs/latest/api/search.html for the full list.
|
|
127
|
+
*
|
|
128
|
+
* This is the SDK's escape hatch when the friendly `getListings` API
|
|
129
|
+
* isn't expressive enough (faceted search, multi-field sort, custom
|
|
130
|
+
* grouping). It's an open dictionary on purpose; the only required
|
|
131
|
+
* field is `q`.
|
|
132
|
+
*/
|
|
133
|
+
interface SearchListingsParams {
|
|
134
|
+
q: string;
|
|
135
|
+
query_by?: string;
|
|
136
|
+
filter_by?: string;
|
|
137
|
+
sort_by?: string;
|
|
138
|
+
per_page?: number;
|
|
139
|
+
page?: number;
|
|
140
|
+
facet_by?: string;
|
|
141
|
+
group_by?: string;
|
|
142
|
+
group_limit?: number;
|
|
143
|
+
/** Any other Typesense param. The SDK passes the whole object through. */
|
|
144
|
+
[key: string]: unknown;
|
|
145
|
+
}
|
|
146
|
+
/**
|
|
147
|
+
* Raw Typesense response shape — what the backend returns from
|
|
148
|
+
* `multi_search`. Generic over the document type so power users can
|
|
149
|
+
* narrow it in their own codebases without losing access to `hits[].
|
|
150
|
+
* highlight` and `text_match`.
|
|
151
|
+
*/
|
|
152
|
+
interface SearchListingsResult<TDocument = Record<string, unknown>> {
|
|
153
|
+
found: number;
|
|
154
|
+
page: number;
|
|
155
|
+
search_time_ms: number;
|
|
156
|
+
hits: Array<{
|
|
157
|
+
document: TDocument;
|
|
158
|
+
highlight?: Record<string, unknown>;
|
|
159
|
+
text_match?: number;
|
|
160
|
+
}>;
|
|
161
|
+
/** Any other Typesense field. Stays open so we don't break on engine upgrades. */
|
|
162
|
+
[key: string]: unknown;
|
|
163
|
+
}
|
|
164
|
+
/** Public summary of a Garagem-managed site. Returned by `getSite`. */
|
|
165
|
+
interface Site {
|
|
166
|
+
id: string;
|
|
167
|
+
name: string;
|
|
168
|
+
domain: string | null;
|
|
169
|
+
tenantId: string;
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* App Router caching hints passed straight through to the underlying
|
|
173
|
+
* `fetch` call. See https://nextjs.org/docs/app/api-reference/functions/fetch.
|
|
174
|
+
*
|
|
175
|
+
* Typed loosely so this works in plain Node, Edge, Cloudflare Workers
|
|
176
|
+
* and Bun runtimes without Next-specific types being mandatory.
|
|
177
|
+
*/
|
|
178
|
+
interface RequestNextOptions {
|
|
179
|
+
revalidate?: number | false;
|
|
180
|
+
tags?: string[];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
/** Custom fetch implementation. Defaults to the global `fetch`. */
|
|
184
|
+
type FetchLike = typeof fetch;
|
|
185
|
+
interface BaseOptions {
|
|
186
|
+
/** Garagem API base URL. Defaults to `https://app.garagem.ai`. */
|
|
187
|
+
baseUrl?: string;
|
|
188
|
+
/** Override the fetch implementation (testing, edge runtimes, retries). */
|
|
189
|
+
fetch?: FetchLike;
|
|
190
|
+
/**
|
|
191
|
+
* Next.js App Router caching hints. Ignored on runtimes that don't
|
|
192
|
+
* understand them.
|
|
193
|
+
*/
|
|
194
|
+
next?: RequestNextOptions;
|
|
195
|
+
}
|
|
196
|
+
interface GetListingsOptions extends BaseOptions {
|
|
197
|
+
siteId: string;
|
|
198
|
+
filters?: ListingFilters;
|
|
199
|
+
}
|
|
200
|
+
interface GetListingOptions extends BaseOptions {
|
|
201
|
+
siteId: string;
|
|
202
|
+
listingId: string;
|
|
203
|
+
}
|
|
204
|
+
interface GetSiteOptions extends BaseOptions {
|
|
205
|
+
/** Look up by site ID, or… */
|
|
206
|
+
siteId?: string;
|
|
207
|
+
/** …by domain. Exactly one of `siteId` / `domain` must be provided. */
|
|
208
|
+
domain?: string;
|
|
209
|
+
}
|
|
210
|
+
interface SearchListingsOptions extends BaseOptions {
|
|
211
|
+
siteId: string;
|
|
212
|
+
params: SearchListingsParams;
|
|
213
|
+
}
|
|
214
|
+
/** Error thrown when a fetcher hits a non-2xx response. */
|
|
215
|
+
declare class GaragemSdkError extends Error {
|
|
216
|
+
readonly status: number;
|
|
217
|
+
readonly url: string;
|
|
218
|
+
constructor(message: string, info: {
|
|
219
|
+
status: number;
|
|
220
|
+
url: string;
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Fetch a paginated list of listings for a given site.
|
|
225
|
+
*
|
|
226
|
+
* @example
|
|
227
|
+
* const { listings } = await getListings({
|
|
228
|
+
* siteId: "abc",
|
|
229
|
+
* filters: { city: "São Paulo", limit: 24 },
|
|
230
|
+
* next: { revalidate: 300, tags: [`site:abc:listings`] },
|
|
231
|
+
* });
|
|
232
|
+
*/
|
|
233
|
+
declare function getListings(options: GetListingsOptions): Promise<ListingsResult>;
|
|
234
|
+
/**
|
|
235
|
+
* Fetch a single listing's full detail (amenities, gallery, building).
|
|
236
|
+
*/
|
|
237
|
+
declare function getListing(options: GetListingOptions): Promise<ListingDetail>;
|
|
238
|
+
/**
|
|
239
|
+
* Resolve a site's public profile by ID or by domain. Returns `null`
|
|
240
|
+
* when the site does not exist or the host is unrecognized.
|
|
241
|
+
*
|
|
242
|
+
* @example
|
|
243
|
+
* const site = await getSite({ domain: "imobiliariax.com.br" });
|
|
244
|
+
* if (!site) return notFound();
|
|
245
|
+
*/
|
|
246
|
+
declare function getSite(options: GetSiteOptions): Promise<Site | null>;
|
|
247
|
+
/**
|
|
248
|
+
* Advanced search escape hatch.
|
|
249
|
+
*
|
|
250
|
+
* Calls `POST /api/sites/{siteId}/search` directly and returns the raw
|
|
251
|
+
* Typesense response (`{ found, page, hits: [{ document, ... }], ... }`).
|
|
252
|
+
* Use when the friendly `getListings({ filters })` API isn't expressive
|
|
253
|
+
* enough — faceted search, multi-field sort, custom grouping, etc.
|
|
254
|
+
*
|
|
255
|
+
* @example
|
|
256
|
+
* const result = await searchListings({
|
|
257
|
+
* siteId: "abc",
|
|
258
|
+
* params: {
|
|
259
|
+
* q: "frente mar",
|
|
260
|
+
* query_by: "title,description,neighborhood",
|
|
261
|
+
* filter_by: "businessType:=sale && bedrooms:>=3",
|
|
262
|
+
* sort_by: "price:asc",
|
|
263
|
+
* per_page: 24,
|
|
264
|
+
* page: 1,
|
|
265
|
+
* facet_by: "neighborhood,propertyType",
|
|
266
|
+
* },
|
|
267
|
+
* });
|
|
268
|
+
* for (const hit of result.hits) {
|
|
269
|
+
* console.log(hit.document, hit.highlight);
|
|
270
|
+
* }
|
|
271
|
+
*/
|
|
272
|
+
declare function searchListings<TDocument = Record<string, unknown>>(options: SearchListingsOptions): Promise<SearchListingsResult<TDocument>>;
|
|
273
|
+
|
|
274
|
+
interface CreateGaragemClientOptions {
|
|
275
|
+
/** Garagem API base URL. Defaults to `https://app.garagem.ai`. */
|
|
276
|
+
baseUrl?: string;
|
|
277
|
+
/** Pre-bind a site so each call doesn't repeat it. */
|
|
278
|
+
siteId?: string;
|
|
279
|
+
/** Custom fetch implementation. */
|
|
280
|
+
fetch?: FetchLike;
|
|
281
|
+
/** Default Next.js caching hints applied to every request. */
|
|
282
|
+
next?: RequestNextOptions;
|
|
283
|
+
}
|
|
284
|
+
interface GaragemClient {
|
|
285
|
+
/** Configuration the client was created with. */
|
|
286
|
+
readonly options: Readonly<CreateGaragemClientOptions>;
|
|
287
|
+
/** List listings for the bound (or explicitly passed) site. */
|
|
288
|
+
getListings(args?: {
|
|
289
|
+
filters?: ListingFilters;
|
|
290
|
+
siteId?: string;
|
|
291
|
+
next?: RequestNextOptions;
|
|
292
|
+
}): Promise<ListingsResult>;
|
|
293
|
+
/** Fetch a single listing detail. */
|
|
294
|
+
getListing(args: {
|
|
295
|
+
listingId: string;
|
|
296
|
+
siteId?: string;
|
|
297
|
+
next?: RequestNextOptions;
|
|
298
|
+
}): Promise<ListingDetail>;
|
|
299
|
+
/** Resolve a site by ID or domain. */
|
|
300
|
+
getSite(args: {
|
|
301
|
+
siteId?: string;
|
|
302
|
+
domain?: string;
|
|
303
|
+
next?: RequestNextOptions;
|
|
304
|
+
}): Promise<Site | null>;
|
|
305
|
+
/**
|
|
306
|
+
* Advanced search — raw Typesense parameters, raw response. Use when
|
|
307
|
+
* the friendly `getListings({ filters })` API isn't expressive enough.
|
|
308
|
+
*/
|
|
309
|
+
searchListings<TDocument = Record<string, unknown>>(args: {
|
|
310
|
+
params: SearchListingsParams;
|
|
311
|
+
siteId?: string;
|
|
312
|
+
next?: RequestNextOptions;
|
|
313
|
+
}): Promise<SearchListingsResult<TDocument>>;
|
|
314
|
+
}
|
|
315
|
+
/**
|
|
316
|
+
* Bind base URL, fetch and site to a single client object. Useful when
|
|
317
|
+
* the same configuration is shared across many calls (RSC pages, API
|
|
318
|
+
* routes, scripts).
|
|
319
|
+
*
|
|
320
|
+
* The bare functions (`getListings`, `getListing`, `getSite`) are also
|
|
321
|
+
* exported for the no-client style.
|
|
322
|
+
*/
|
|
323
|
+
declare function createGaragemClient(options?: CreateGaragemClientOptions): GaragemClient;
|
|
324
|
+
|
|
325
|
+
export { type CreateGaragemClientOptions, type FetchLike, type GaragemClient, GaragemSdkError, type GetListingOptions, type GetListingsOptions, type GetSiteOptions, type Listing, type ListingBusinessType, type ListingDetail, type ListingFilters, type ListingLocation, type ListingMedia, type ListingPriceVisibility, type ListingPropertySummary, type ListingsResult, type RequestNextOptions, type SearchListingsOptions, type SearchListingsParams, type SearchListingsResult, type Site, createGaragemClient, getListing, getListings, getSite, searchListings };
|