Skip to content

Commit 5f2c48b

Browse files
VinciGit00claude
andcommitted
refactor: rename locationGeoCode to country in search
Matches FetchConfig.country naming convention. Serializes as locationGeoCode on the wire for API compatibility. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent 016ae8b commit 5f2c48b

3 files changed

Lines changed: 5 additions & 3 deletions

File tree

src/lib/utils.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,9 @@ export function buildExtractBody(url: string | undefined, extractOptions: ApiExt
119119
}
120120

121121
export function buildSearchBody(query: string, searchOptions?: ApiSearchOptions) {
122-
const body: Record<string, unknown> = { query, ...searchOptions };
122+
const { country, ...rest } = searchOptions ?? {};
123+
const body: Record<string, unknown> = { query, ...rest };
124+
if (country) body.locationGeoCode = country;
123125
if (searchOptions?.schema) body.schema = toJsonSchema(searchOptions.schema);
124126
return body;
125127
}

src/schemas.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -219,7 +219,7 @@ export const apiSearchRequestSchema = z
219219
fetchConfig: apiFetchConfigSchema.optional(),
220220
prompt: apiUserPromptSchema.optional(),
221221
schema: z.record(z.string(), z.unknown()).optional(),
222-
locationGeoCode: z.string().max(10).optional(),
222+
country: z.string().max(10).optional(),
223223
timeRange: z
224224
.enum(["past_hour", "past_24_hours", "past_week", "past_month", "past_year"])
225225
.optional(),

tests/client.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ describe("scrapegraphai", () => {
148148
numResults: 1,
149149
prompt: "Find the title",
150150
schema: z.object({ title: z.string() }),
151-
locationGeoCode: "it",
151+
country: "it",
152152
timeRange: "past_week",
153153
});
154154
expect(body).toEqual({

0 commit comments

Comments
 (0)