aboutsummaryrefslogtreecommitdiffstats
path: root/packages
diff options
context:
space:
mode:
Diffstat (limited to 'packages')
-rw-r--r--packages/open-api/hoarder-openapi-spec.json55
-rw-r--r--packages/open-api/lib/bookmarks.ts8
-rw-r--r--packages/open-api/lib/lists.ts8
-rw-r--r--packages/open-api/lib/pagination.ts9
-rw-r--r--packages/open-api/lib/tags.ts8
-rw-r--r--packages/sdk/src/hoarder-api.d.ts13
-rw-r--r--packages/shared/types/bookmarks.ts1
-rw-r--r--packages/trpc/routers/bookmarks.ts4
8 files changed, 96 insertions, 10 deletions
diff --git a/packages/open-api/hoarder-openapi-spec.json b/packages/open-api/hoarder-openapi-spec.json
index dfe7c761..9a1d8634 100644
--- a/packages/open-api/hoarder-openapi-spec.json
+++ b/packages/open-api/hoarder-openapi-spec.json
@@ -564,6 +564,17 @@
"required": false,
"name": "cursor",
"in": "query"
+ },
+ {
+ "schema": {
+ "type": "boolean",
+ "default": true,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks."
+ },
+ "required": false,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ "name": "includeContent",
+ "in": "query"
}
],
"responses": {
@@ -778,6 +789,17 @@
"required": false,
"name": "cursor",
"in": "query"
+ },
+ {
+ "schema": {
+ "type": "boolean",
+ "default": true,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks."
+ },
+ "required": false,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ "name": "includeContent",
+ "in": "query"
}
],
"responses": {
@@ -809,6 +831,17 @@
"parameters": [
{
"$ref": "#/components/parameters/BookmarkId"
+ },
+ {
+ "schema": {
+ "type": "boolean",
+ "default": true,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks."
+ },
+ "required": false,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ "name": "includeContent",
+ "in": "query"
}
],
"responses": {
@@ -1965,6 +1998,17 @@
"required": false,
"name": "cursor",
"in": "query"
+ },
+ {
+ "schema": {
+ "type": "boolean",
+ "default": true,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks."
+ },
+ "required": false,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ "name": "includeContent",
+ "in": "query"
}
],
"responses": {
@@ -2374,6 +2418,17 @@
"required": false,
"name": "cursor",
"in": "query"
+ },
+ {
+ "schema": {
+ "type": "boolean",
+ "default": true,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks."
+ },
+ "required": false,
+ "description": "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ "name": "includeContent",
+ "in": "query"
}
],
"responses": {
diff --git a/packages/open-api/lib/bookmarks.ts b/packages/open-api/lib/bookmarks.ts
index 51c67369..e344d656 100644
--- a/packages/open-api/lib/bookmarks.ts
+++ b/packages/open-api/lib/bookmarks.ts
@@ -17,6 +17,7 @@ import { ErrorSchema } from "./errors";
import { HighlightSchema } from "./highlights";
import {
BookmarkSchema,
+ IncludeContentSearchParamSchema,
PaginatedBookmarksSchema,
PaginationSchema,
} from "./pagination";
@@ -60,7 +61,8 @@ registry.registerPath({
archived: z.boolean().optional(),
favourited: z.boolean().optional(),
})
- .merge(PaginationSchema),
+ .merge(PaginationSchema)
+ .merge(IncludeContentSearchParamSchema),
},
responses: {
200: {
@@ -86,7 +88,8 @@ registry.registerPath({
.object({
q: z.string(),
})
- .merge(PaginationSchema),
+ .merge(PaginationSchema)
+ .merge(IncludeContentSearchParamSchema),
},
responses: {
200: {
@@ -145,6 +148,7 @@ registry.registerPath({
security: [{ [BearerAuth.name]: [] }],
request: {
params: z.object({ bookmarkId: BookmarkIdSchema }),
+ query: IncludeContentSearchParamSchema,
},
responses: {
200: {
diff --git a/packages/open-api/lib/lists.ts b/packages/open-api/lib/lists.ts
index f2c0d954..2273d33b 100644
--- a/packages/open-api/lib/lists.ts
+++ b/packages/open-api/lib/lists.ts
@@ -13,7 +13,11 @@ import {
import { BookmarkIdSchema } from "./bookmarks";
import { BearerAuth } from "./common";
import { ErrorSchema } from "./errors";
-import { PaginatedBookmarksSchema, PaginationSchema } from "./pagination";
+import {
+ IncludeContentSearchParamSchema,
+ PaginatedBookmarksSchema,
+ PaginationSchema,
+} from "./pagination";
export const registry = new OpenAPIRegistry();
extendZodWithOpenApi(z);
@@ -192,7 +196,7 @@ registry.registerPath({
security: [{ [BearerAuth.name]: [] }],
request: {
params: z.object({ listId: ListIdSchema }),
- query: PaginationSchema,
+ query: PaginationSchema.merge(IncludeContentSearchParamSchema),
},
responses: {
200: {
diff --git a/packages/open-api/lib/pagination.ts b/packages/open-api/lib/pagination.ts
index dfe835e2..382f00ef 100644
--- a/packages/open-api/lib/pagination.ts
+++ b/packages/open-api/lib/pagination.ts
@@ -22,3 +22,12 @@ export const PaginationSchema = z
cursor: CursorSchema.optional(),
})
.openapi("Pagination");
+
+export const IncludeContentSearchParamSchema = z.object({
+ includeContent: z
+ .boolean()
+ .default(true)
+ .describe(
+ "If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks.",
+ ),
+});
diff --git a/packages/open-api/lib/tags.ts b/packages/open-api/lib/tags.ts
index 86353924..c51e3b84 100644
--- a/packages/open-api/lib/tags.ts
+++ b/packages/open-api/lib/tags.ts
@@ -11,7 +11,11 @@ import {
import { BearerAuth } from "./common";
import { ErrorSchema } from "./errors";
-import { PaginatedBookmarksSchema, PaginationSchema } from "./pagination";
+import {
+ IncludeContentSearchParamSchema,
+ PaginatedBookmarksSchema,
+ PaginationSchema,
+} from "./pagination";
export const registry = new OpenAPIRegistry();
extendZodWithOpenApi(z);
@@ -154,7 +158,7 @@ registry.registerPath({
security: [{ [BearerAuth.name]: [] }],
request: {
params: z.object({ tagId: TagIdSchema }),
- query: PaginationSchema,
+ query: PaginationSchema.merge(IncludeContentSearchParamSchema),
},
responses: {
200: {
diff --git a/packages/sdk/src/hoarder-api.d.ts b/packages/sdk/src/hoarder-api.d.ts
index 2b9986d3..0b434b3d 100644
--- a/packages/sdk/src/hoarder-api.d.ts
+++ b/packages/sdk/src/hoarder-api.d.ts
@@ -22,6 +22,8 @@ export interface paths {
favourited?: boolean;
limit?: number;
cursor?: components["schemas"]["Cursor"];
+ /** @description If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks. */
+ includeContent?: boolean;
};
header?: never;
path?: never;
@@ -135,6 +137,8 @@ export interface paths {
q: string;
limit?: number;
cursor?: components["schemas"]["Cursor"];
+ /** @description If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks. */
+ includeContent?: boolean;
};
header?: never;
path?: never;
@@ -174,7 +178,10 @@ export interface paths {
*/
get: {
parameters: {
- query?: never;
+ query?: {
+ /** @description If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks. */
+ includeContent?: boolean;
+ };
header?: never;
path: {
bookmarkId: components["parameters"]["BookmarkId"];
@@ -972,6 +979,8 @@ export interface paths {
query?: {
limit?: number;
cursor?: components["schemas"]["Cursor"];
+ /** @description If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks. */
+ includeContent?: boolean;
};
header?: never;
path: {
@@ -1313,6 +1322,8 @@ export interface paths {
query?: {
limit?: number;
cursor?: components["schemas"]["Cursor"];
+ /** @description If set to true, bookmark's content will be included in the response. Note, this content can be large for some bookmarks. */
+ includeContent?: boolean;
};
header?: never;
path: {
diff --git a/packages/shared/types/bookmarks.ts b/packages/shared/types/bookmarks.ts
index 8df0e375..3cac2845 100644
--- a/packages/shared/types/bookmarks.ts
+++ b/packages/shared/types/bookmarks.ts
@@ -239,4 +239,5 @@ export const zSearchBookmarksRequestSchema = z.object({
limit: z.number().max(MAX_NUM_BOOKMARKS_PER_PAGE).optional(),
cursor: zSearchBookmarksCursor.nullish(),
sortOrder: zSortOrder.optional().default("desc"),
+ includeContent: z.boolean().optional().default(false),
});
diff --git a/packages/trpc/routers/bookmarks.ts b/packages/trpc/routers/bookmarks.ts
index a02fb691..9a1b6b0b 100644
--- a/packages/trpc/routers/bookmarks.ts
+++ b/packages/trpc/routers/bookmarks.ts
@@ -761,9 +761,7 @@ export const bookmarksAppRouter = router({
results.sort((a, b) => idToRank[b.id] - idToRank[a.id]);
return {
- bookmarks: results.map((b) =>
- toZodSchema(b, /* includeContent: */ false),
- ),
+ bookmarks: results.map((b) => toZodSchema(b, input.includeContent)),
nextCursor:
resp.hits.length + resp.offset >= resp.estimatedTotalHits
? null