@mx-space/api-client 2.0.0 → 2.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/dist/index.cjs +11 -5
- package/dist/index.d.cts +37 -26
- package/dist/index.d.mts +37 -26
- package/dist/index.mjs +11 -5
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -509,11 +509,12 @@ var NoteController = class {
|
|
|
509
509
|
* @param options 可选参数:password, single, lang
|
|
510
510
|
*/
|
|
511
511
|
getNoteByNid(nid, options) {
|
|
512
|
-
const { password, single, lang } = options || {};
|
|
512
|
+
const { password, single, lang, prefer } = options || {};
|
|
513
513
|
return this.proxy.nid(nid.toString()).get({ params: {
|
|
514
514
|
password,
|
|
515
515
|
single: single ? "1" : void 0,
|
|
516
|
-
lang
|
|
516
|
+
lang,
|
|
517
|
+
prefer
|
|
517
518
|
} });
|
|
518
519
|
}
|
|
519
520
|
/**
|
|
@@ -672,8 +673,8 @@ var PageController = class {
|
|
|
672
673
|
* @param slug 路径
|
|
673
674
|
* @returns
|
|
674
675
|
*/
|
|
675
|
-
getBySlug(slug) {
|
|
676
|
-
return this.proxy.slug(slug).get({});
|
|
676
|
+
getBySlug(slug, options) {
|
|
677
|
+
return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
|
|
677
678
|
}
|
|
678
679
|
};
|
|
679
680
|
|
|
@@ -711,7 +712,12 @@ var PostController = class {
|
|
|
711
712
|
}
|
|
712
713
|
getPost(idOrCategoryName, slug, options) {
|
|
713
714
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
714
|
-
else
|
|
715
|
+
else {
|
|
716
|
+
const params = {};
|
|
717
|
+
if (options?.lang) params.lang = options.lang;
|
|
718
|
+
if (options?.prefer) params.prefer = options.prefer;
|
|
719
|
+
return this.proxy(idOrCategoryName)(slug).get({ params: Object.keys(params).length ? params : void 0 });
|
|
720
|
+
}
|
|
715
721
|
}
|
|
716
722
|
/**
|
|
717
723
|
* 获取最新的文章
|
package/dist/index.d.cts
CHANGED
|
@@ -165,14 +165,23 @@ interface BaseCommentIndexModel extends BaseModel {
|
|
|
165
165
|
commentsIndex?: number;
|
|
166
166
|
allowComment: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface
|
|
168
|
+
interface TextBaseModelMarkdown extends BaseCommentIndexModel {
|
|
169
169
|
title: string;
|
|
170
170
|
text: string;
|
|
171
|
+
contentFormat?: 'markdown';
|
|
172
|
+
content?: undefined;
|
|
171
173
|
images?: Image[];
|
|
172
174
|
modified: string | null;
|
|
173
|
-
contentFormat?: 'markdown' | 'lexical';
|
|
174
|
-
content?: string;
|
|
175
175
|
}
|
|
176
|
+
interface TextBaseModelLexical extends BaseCommentIndexModel {
|
|
177
|
+
title: string;
|
|
178
|
+
text?: string;
|
|
179
|
+
contentFormat: 'lexical';
|
|
180
|
+
content: string;
|
|
181
|
+
images?: Image[];
|
|
182
|
+
modified: string | null;
|
|
183
|
+
}
|
|
184
|
+
type TextBaseModel = TextBaseModelMarkdown | TextBaseModelLexical;
|
|
176
185
|
type ModelWithLiked<T> = T & {
|
|
177
186
|
liked: boolean;
|
|
178
187
|
};
|
|
@@ -188,13 +197,11 @@ type ModelWithTranslation<T> = T & {
|
|
|
188
197
|
};
|
|
189
198
|
//#endregion
|
|
190
199
|
//#region models/post.d.ts
|
|
191
|
-
|
|
200
|
+
type PostModel = TextBaseModel & {
|
|
192
201
|
summary?: string | null;
|
|
193
202
|
copyright: boolean;
|
|
194
203
|
tags: string[];
|
|
195
204
|
count: Count;
|
|
196
|
-
text: string;
|
|
197
|
-
title: string;
|
|
198
205
|
slug: string;
|
|
199
206
|
categoryId: string;
|
|
200
207
|
images: Image[];
|
|
@@ -202,7 +209,7 @@ interface PostModel extends TextBaseModel {
|
|
|
202
209
|
pin?: string | null;
|
|
203
210
|
pinOrder?: number;
|
|
204
211
|
related?: Pick<PostModel, 'id' | 'category' | 'categoryId' | 'created' | 'modified' | 'title' | 'slug' | 'summary'>[];
|
|
205
|
-
}
|
|
212
|
+
};
|
|
206
213
|
//#endregion
|
|
207
214
|
//#region models/category.d.ts
|
|
208
215
|
declare enum CategoryType {
|
|
@@ -355,7 +362,7 @@ interface TopicModel extends BaseModel {
|
|
|
355
362
|
}
|
|
356
363
|
//#endregion
|
|
357
364
|
//#region models/note.d.ts
|
|
358
|
-
|
|
365
|
+
type NoteModel = TextBaseModel & {
|
|
359
366
|
isPublished: boolean;
|
|
360
367
|
count: {
|
|
361
368
|
read: number;
|
|
@@ -371,7 +378,7 @@ interface NoteModel extends TextBaseModel {
|
|
|
371
378
|
coordinates?: Coordinate;
|
|
372
379
|
topic?: TopicModel;
|
|
373
380
|
topicId?: string;
|
|
374
|
-
}
|
|
381
|
+
};
|
|
375
382
|
interface Coordinate {
|
|
376
383
|
latitude: number;
|
|
377
384
|
longitude: number;
|
|
@@ -398,14 +405,14 @@ declare enum EnumPageType {
|
|
|
398
405
|
'html' = "html",
|
|
399
406
|
'frame' = "frame"
|
|
400
407
|
}
|
|
401
|
-
|
|
408
|
+
type PageModel = TextBaseModel & {
|
|
402
409
|
created: string;
|
|
403
410
|
slug: string;
|
|
404
411
|
subtitle?: string;
|
|
405
412
|
order?: number;
|
|
406
413
|
type?: EnumPageType;
|
|
407
414
|
options?: object;
|
|
408
|
-
}
|
|
415
|
+
};
|
|
409
416
|
//#endregion
|
|
410
417
|
//#region models/say.d.ts
|
|
411
418
|
interface SayModel extends BaseModel {
|
|
@@ -1444,7 +1451,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1444
1451
|
name: string;
|
|
1445
1452
|
created: string;
|
|
1446
1453
|
id: string;
|
|
1447
|
-
children: Pick<PostModel, "id" | "
|
|
1454
|
+
children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
|
|
1448
1455
|
} : T_1 : never : never;
|
|
1449
1456
|
} : ResponseWrapper;
|
|
1450
1457
|
$request: {
|
|
@@ -1496,7 +1503,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1496
1503
|
};
|
|
1497
1504
|
}) ? T_1 extends unknown ? {
|
|
1498
1505
|
tag: string;
|
|
1499
|
-
data: Pick<PostModel, "category" | "id" | "
|
|
1506
|
+
data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
|
|
1500
1507
|
} : T_1 : never : never;
|
|
1501
1508
|
} : ResponseWrapper;
|
|
1502
1509
|
$request: {
|
|
@@ -1686,6 +1693,7 @@ type NoteByNidOptions = {
|
|
|
1686
1693
|
password?: string;
|
|
1687
1694
|
single?: boolean;
|
|
1688
1695
|
lang?: string;
|
|
1696
|
+
prefer?: 'lexical';
|
|
1689
1697
|
};
|
|
1690
1698
|
type NoteMiddleListOptions = {
|
|
1691
1699
|
lang?: string;
|
|
@@ -1999,7 +2007,9 @@ declare class PageController<ResponseWrapper> implements IController {
|
|
|
1999
2007
|
* @param slug 路径
|
|
2000
2008
|
* @returns
|
|
2001
2009
|
*/
|
|
2002
|
-
getBySlug(slug: string
|
|
2010
|
+
getBySlug(slug: string, options?: {
|
|
2011
|
+
prefer?: 'lexical';
|
|
2012
|
+
}): RequestProxyResult<PageModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2003
2013
|
[key: string]: any;
|
|
2004
2014
|
data: PageModel;
|
|
2005
2015
|
} : ResponseWrapper extends {
|
|
@@ -2057,6 +2067,7 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
2057
2067
|
*/
|
|
2058
2068
|
getPost(categoryName: string, slug: string, options?: {
|
|
2059
2069
|
lang?: string;
|
|
2070
|
+
prefer?: 'lexical';
|
|
2060
2071
|
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
2061
2072
|
/**
|
|
2062
2073
|
* 根据 ID 查找文章
|
|
@@ -2295,11 +2306,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2295
2306
|
* @param options
|
|
2296
2307
|
* @returns
|
|
2297
2308
|
*/
|
|
2298
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2309
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2299
2310
|
type: "post";
|
|
2300
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2311
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2301
2312
|
type: "note";
|
|
2302
|
-
}) | (Pick<PageModel, "id" | "
|
|
2313
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2303
2314
|
type: "page";
|
|
2304
2315
|
})> & {
|
|
2305
2316
|
/**
|
|
@@ -2308,11 +2319,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2308
2319
|
raw?: any;
|
|
2309
2320
|
}, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2310
2321
|
[key: string]: any;
|
|
2311
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2322
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2312
2323
|
type: "post";
|
|
2313
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2324
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2314
2325
|
type: "note";
|
|
2315
|
-
}) | (Pick<PageModel, "id" | "
|
|
2326
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2316
2327
|
type: "page";
|
|
2317
2328
|
})> & {
|
|
2318
2329
|
/**
|
|
@@ -2321,11 +2332,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2321
2332
|
raw?: any;
|
|
2322
2333
|
}, ResponseWrapper>;
|
|
2323
2334
|
} : ResponseWrapper extends {
|
|
2324
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2335
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2325
2336
|
type: "post";
|
|
2326
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2337
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2327
2338
|
type: "note";
|
|
2328
|
-
}) | (Pick<PageModel, "id" | "
|
|
2339
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2329
2340
|
type: "page";
|
|
2330
2341
|
})> & {
|
|
2331
2342
|
/**
|
|
@@ -2334,11 +2345,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2334
2345
|
raw?: any;
|
|
2335
2346
|
}, ResponseWrapper>;
|
|
2336
2347
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2337
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2348
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2338
2349
|
type: "post";
|
|
2339
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2350
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2340
2351
|
type: "note";
|
|
2341
|
-
}) | (Pick<PageModel, "id" | "
|
|
2352
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2342
2353
|
type: "page";
|
|
2343
2354
|
})> & {
|
|
2344
2355
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -165,14 +165,23 @@ interface BaseCommentIndexModel extends BaseModel {
|
|
|
165
165
|
commentsIndex?: number;
|
|
166
166
|
allowComment: boolean;
|
|
167
167
|
}
|
|
168
|
-
interface
|
|
168
|
+
interface TextBaseModelMarkdown extends BaseCommentIndexModel {
|
|
169
169
|
title: string;
|
|
170
170
|
text: string;
|
|
171
|
+
contentFormat?: 'markdown';
|
|
172
|
+
content?: undefined;
|
|
171
173
|
images?: Image[];
|
|
172
174
|
modified: string | null;
|
|
173
|
-
contentFormat?: 'markdown' | 'lexical';
|
|
174
|
-
content?: string;
|
|
175
175
|
}
|
|
176
|
+
interface TextBaseModelLexical extends BaseCommentIndexModel {
|
|
177
|
+
title: string;
|
|
178
|
+
text?: string;
|
|
179
|
+
contentFormat: 'lexical';
|
|
180
|
+
content: string;
|
|
181
|
+
images?: Image[];
|
|
182
|
+
modified: string | null;
|
|
183
|
+
}
|
|
184
|
+
type TextBaseModel = TextBaseModelMarkdown | TextBaseModelLexical;
|
|
176
185
|
type ModelWithLiked<T> = T & {
|
|
177
186
|
liked: boolean;
|
|
178
187
|
};
|
|
@@ -188,13 +197,11 @@ type ModelWithTranslation<T> = T & {
|
|
|
188
197
|
};
|
|
189
198
|
//#endregion
|
|
190
199
|
//#region models/post.d.ts
|
|
191
|
-
|
|
200
|
+
type PostModel = TextBaseModel & {
|
|
192
201
|
summary?: string | null;
|
|
193
202
|
copyright: boolean;
|
|
194
203
|
tags: string[];
|
|
195
204
|
count: Count;
|
|
196
|
-
text: string;
|
|
197
|
-
title: string;
|
|
198
205
|
slug: string;
|
|
199
206
|
categoryId: string;
|
|
200
207
|
images: Image[];
|
|
@@ -202,7 +209,7 @@ interface PostModel extends TextBaseModel {
|
|
|
202
209
|
pin?: string | null;
|
|
203
210
|
pinOrder?: number;
|
|
204
211
|
related?: Pick<PostModel, 'id' | 'category' | 'categoryId' | 'created' | 'modified' | 'title' | 'slug' | 'summary'>[];
|
|
205
|
-
}
|
|
212
|
+
};
|
|
206
213
|
//#endregion
|
|
207
214
|
//#region models/category.d.ts
|
|
208
215
|
declare enum CategoryType {
|
|
@@ -355,7 +362,7 @@ interface TopicModel extends BaseModel {
|
|
|
355
362
|
}
|
|
356
363
|
//#endregion
|
|
357
364
|
//#region models/note.d.ts
|
|
358
|
-
|
|
365
|
+
type NoteModel = TextBaseModel & {
|
|
359
366
|
isPublished: boolean;
|
|
360
367
|
count: {
|
|
361
368
|
read: number;
|
|
@@ -371,7 +378,7 @@ interface NoteModel extends TextBaseModel {
|
|
|
371
378
|
coordinates?: Coordinate;
|
|
372
379
|
topic?: TopicModel;
|
|
373
380
|
topicId?: string;
|
|
374
|
-
}
|
|
381
|
+
};
|
|
375
382
|
interface Coordinate {
|
|
376
383
|
latitude: number;
|
|
377
384
|
longitude: number;
|
|
@@ -398,14 +405,14 @@ declare enum EnumPageType {
|
|
|
398
405
|
'html' = "html",
|
|
399
406
|
'frame' = "frame"
|
|
400
407
|
}
|
|
401
|
-
|
|
408
|
+
type PageModel = TextBaseModel & {
|
|
402
409
|
created: string;
|
|
403
410
|
slug: string;
|
|
404
411
|
subtitle?: string;
|
|
405
412
|
order?: number;
|
|
406
413
|
type?: EnumPageType;
|
|
407
414
|
options?: object;
|
|
408
|
-
}
|
|
415
|
+
};
|
|
409
416
|
//#endregion
|
|
410
417
|
//#region models/say.d.ts
|
|
411
418
|
interface SayModel extends BaseModel {
|
|
@@ -1444,7 +1451,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1444
1451
|
name: string;
|
|
1445
1452
|
created: string;
|
|
1446
1453
|
id: string;
|
|
1447
|
-
children: Pick<PostModel, "id" | "
|
|
1454
|
+
children: Pick<PostModel, "id" | "title" | "slug" | "modified" | "created">[];
|
|
1448
1455
|
} : T_1 : never : never;
|
|
1449
1456
|
} : ResponseWrapper;
|
|
1450
1457
|
$request: {
|
|
@@ -1496,7 +1503,7 @@ declare class CategoryController<ResponseWrapper> implements IController {
|
|
|
1496
1503
|
};
|
|
1497
1504
|
}) ? T_1 extends unknown ? {
|
|
1498
1505
|
tag: string;
|
|
1499
|
-
data: Pick<PostModel, "category" | "id" | "
|
|
1506
|
+
data: Pick<PostModel, "category" | "id" | "title" | "slug" | "created">[];
|
|
1500
1507
|
} : T_1 : never : never;
|
|
1501
1508
|
} : ResponseWrapper;
|
|
1502
1509
|
$request: {
|
|
@@ -1686,6 +1693,7 @@ type NoteByNidOptions = {
|
|
|
1686
1693
|
password?: string;
|
|
1687
1694
|
single?: boolean;
|
|
1688
1695
|
lang?: string;
|
|
1696
|
+
prefer?: 'lexical';
|
|
1689
1697
|
};
|
|
1690
1698
|
type NoteMiddleListOptions = {
|
|
1691
1699
|
lang?: string;
|
|
@@ -1999,7 +2007,9 @@ declare class PageController<ResponseWrapper> implements IController {
|
|
|
1999
2007
|
* @param slug 路径
|
|
2000
2008
|
* @returns
|
|
2001
2009
|
*/
|
|
2002
|
-
getBySlug(slug: string
|
|
2010
|
+
getBySlug(slug: string, options?: {
|
|
2011
|
+
prefer?: 'lexical';
|
|
2012
|
+
}): RequestProxyResult<PageModel, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2003
2013
|
[key: string]: any;
|
|
2004
2014
|
data: PageModel;
|
|
2005
2015
|
} : ResponseWrapper extends {
|
|
@@ -2057,6 +2067,7 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
2057
2067
|
*/
|
|
2058
2068
|
getPost(categoryName: string, slug: string, options?: {
|
|
2059
2069
|
lang?: string;
|
|
2070
|
+
prefer?: 'lexical';
|
|
2060
2071
|
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
2061
2072
|
/**
|
|
2062
2073
|
* 根据 ID 查找文章
|
|
@@ -2295,11 +2306,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2295
2306
|
* @param options
|
|
2296
2307
|
* @returns
|
|
2297
2308
|
*/
|
|
2298
|
-
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2309
|
+
searchByAlgolia(keyword: string, options?: SearchOption): RequestProxyResult<RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2299
2310
|
type: "post";
|
|
2300
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2311
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2301
2312
|
type: "note";
|
|
2302
|
-
}) | (Pick<PageModel, "id" | "
|
|
2313
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2303
2314
|
type: "page";
|
|
2304
2315
|
})> & {
|
|
2305
2316
|
/**
|
|
@@ -2308,11 +2319,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2308
2319
|
raw?: any;
|
|
2309
2320
|
}, ResponseWrapper>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
2310
2321
|
[key: string]: any;
|
|
2311
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2322
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2312
2323
|
type: "post";
|
|
2313
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2324
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2314
2325
|
type: "note";
|
|
2315
|
-
}) | (Pick<PageModel, "id" | "
|
|
2326
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2316
2327
|
type: "page";
|
|
2317
2328
|
})> & {
|
|
2318
2329
|
/**
|
|
@@ -2321,11 +2332,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2321
2332
|
raw?: any;
|
|
2322
2333
|
}, ResponseWrapper>;
|
|
2323
2334
|
} : ResponseWrapper extends {
|
|
2324
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2335
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2325
2336
|
type: "post";
|
|
2326
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2337
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2327
2338
|
type: "note";
|
|
2328
|
-
}) | (Pick<PageModel, "id" | "
|
|
2339
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2329
2340
|
type: "page";
|
|
2330
2341
|
})> & {
|
|
2331
2342
|
/**
|
|
@@ -2334,11 +2345,11 @@ declare class SearchController<ResponseWrapper> implements IController {
|
|
|
2334
2345
|
raw?: any;
|
|
2335
2346
|
}, ResponseWrapper>;
|
|
2336
2347
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
2337
|
-
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "
|
|
2348
|
+
data: RequestProxyResult<PaginateResult<(Pick<PostModel, "category" | "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2338
2349
|
type: "post";
|
|
2339
|
-
}) | (Pick<NoteModel, "id" | "
|
|
2350
|
+
}) | (Pick<NoteModel, "id" | "title" | "modified" | "created" | "nid"> & {
|
|
2340
2351
|
type: "note";
|
|
2341
|
-
}) | (Pick<PageModel, "id" | "
|
|
2352
|
+
}) | (Pick<PageModel, "id" | "title" | "slug" | "modified" | "created"> & {
|
|
2342
2353
|
type: "page";
|
|
2343
2354
|
})> & {
|
|
2344
2355
|
/**
|
package/dist/index.mjs
CHANGED
|
@@ -507,11 +507,12 @@ var NoteController = class {
|
|
|
507
507
|
* @param options 可选参数:password, single, lang
|
|
508
508
|
*/
|
|
509
509
|
getNoteByNid(nid, options) {
|
|
510
|
-
const { password, single, lang } = options || {};
|
|
510
|
+
const { password, single, lang, prefer } = options || {};
|
|
511
511
|
return this.proxy.nid(nid.toString()).get({ params: {
|
|
512
512
|
password,
|
|
513
513
|
single: single ? "1" : void 0,
|
|
514
|
-
lang
|
|
514
|
+
lang,
|
|
515
|
+
prefer
|
|
515
516
|
} });
|
|
516
517
|
}
|
|
517
518
|
/**
|
|
@@ -670,8 +671,8 @@ var PageController = class {
|
|
|
670
671
|
* @param slug 路径
|
|
671
672
|
* @returns
|
|
672
673
|
*/
|
|
673
|
-
getBySlug(slug) {
|
|
674
|
-
return this.proxy.slug(slug).get({});
|
|
674
|
+
getBySlug(slug, options) {
|
|
675
|
+
return this.proxy.slug(slug).get({ params: options?.prefer ? { prefer: options.prefer } : void 0 });
|
|
675
676
|
}
|
|
676
677
|
};
|
|
677
678
|
|
|
@@ -709,7 +710,12 @@ var PostController = class {
|
|
|
709
710
|
}
|
|
710
711
|
getPost(idOrCategoryName, slug, options) {
|
|
711
712
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
712
|
-
else
|
|
713
|
+
else {
|
|
714
|
+
const params = {};
|
|
715
|
+
if (options?.lang) params.lang = options.lang;
|
|
716
|
+
if (options?.prefer) params.prefer = options.prefer;
|
|
717
|
+
return this.proxy(idOrCategoryName)(slug).get({ params: Object.keys(params).length ? params : void 0 });
|
|
718
|
+
}
|
|
713
719
|
}
|
|
714
720
|
/**
|
|
715
721
|
* 获取最新的文章
|