@mx-space/api-client 1.19.1 → 1.21.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/LICENSE +33 -0
- package/dist/adaptors/axios.cjs +2 -2
- package/dist/adaptors/axios.d.cts +1 -1
- package/dist/adaptors/axios.d.mts +1 -1
- package/dist/adaptors/fetch.cjs +1 -0
- package/dist/adaptors/fetch.d.cts +1 -1
- package/dist/adaptors/fetch.d.mts +1 -1
- package/dist/adaptors/umi-request.cjs +1 -1
- package/dist/adaptors/umi-request.d.cts +1 -1
- package/dist/adaptors/umi-request.d.mts +1 -1
- package/dist/index.cjs +21 -6
- package/dist/index.d.cts +45 -9
- package/dist/index.d.mts +45 -9
- package/dist/index.mjs +20 -5
- package/package.json +9 -9
- /package/dist/{adapter-B1dtiutp.d.cts → adapter-D1g1obyM.d.mts} +0 -0
- /package/dist/{adapter-CRsPadpS.d.mts → adapter-DLzJOGbI.d.cts} +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
** Mix Space Open Source License**
|
|
2
|
+
|
|
3
|
+
This project is dual-licensed under different terms for different parts of the project. It is important for users and contributors to understand the licensing terms applicable to each part of the project.
|
|
4
|
+
|
|
5
|
+
### For the `apps/` Directory
|
|
6
|
+
|
|
7
|
+
**License:** GNU Affero General Public License v3.0 (AGPLv3) with Additional Terms (ADDITIONAL_TERMS).
|
|
8
|
+
|
|
9
|
+
**Scope:** This license applies exclusively to all files within the `apps/` directory of this project.
|
|
10
|
+
|
|
11
|
+
**Summary:**
|
|
12
|
+
- The AGPLv3 is a free, copyleft license suitable for software that will be distributed over a network. It allows users to use, modify, and distribute the software and any modifications under the same terms.
|
|
13
|
+
- The "Additional Terms" (ADDITIONAL_TERMS) are specific conditions that are added to the AGPLv3 license. These terms must be reviewed in the accompanying LICENSE file or documentation to understand any additional restrictions or permissions that apply to the software.
|
|
14
|
+
|
|
15
|
+
### For Other Parts of the Project
|
|
16
|
+
|
|
17
|
+
**License:** MIT License.
|
|
18
|
+
|
|
19
|
+
**Scope:** This license applies to all parts of the project that are not included within the `apps/` directory.
|
|
20
|
+
|
|
21
|
+
**Summary:**
|
|
22
|
+
- The MIT License is a permissive open-source license that allows users considerable freedom. It permits use, copying, modification, merging, publishing, distribution, sublicensing, and/or selling copies of the software.
|
|
23
|
+
- It also protects the authors by including a limitation of liability and a disclaimer of warranty.
|
|
24
|
+
|
|
25
|
+
**General Conditions:**
|
|
26
|
+
- Redistribution and use in source and binary forms, with or without modification, are permitted provided that the above license notices and this permission notice appear in all copies of the software.
|
|
27
|
+
- The software is provided "as is", without warranty of any kind, express or implied, including but not limited to the warranties of merchantability, fitness for a particular purpose, and noninfringement.
|
|
28
|
+
|
|
29
|
+
**Contribution:**
|
|
30
|
+
- Contributions to this project are accepted under the terms of the same license as the part of the project to which the contribution is made.
|
|
31
|
+
|
|
32
|
+
**Notice:**
|
|
33
|
+
- This summary is not the license itself and is not a substitute for reading the licenses in their entirety. All users and contributors are encouraged to read the full text of the licenses for a comprehensive understanding.
|
package/dist/adaptors/axios.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
Object.
|
|
2
|
-
//#region
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
|
+
//#region \0rolldown/runtime.js
|
|
3
3
|
var __create = Object.create;
|
|
4
4
|
var __defProp = Object.defineProperty;
|
|
5
5
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
package/dist/adaptors/fetch.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
const require_adaptors_axios = require('./axios.cjs');
|
|
3
3
|
let umi_request = require("umi-request");
|
|
4
4
|
|
package/dist/index.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
Object.
|
|
1
|
+
Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: 'Module' } });
|
|
2
2
|
|
|
3
3
|
//#region utils/index.ts
|
|
4
4
|
const isPlainObject = (obj) => isObject(obj) && Object.prototype.toString.call(obj) === "[object Object]" && Object.getPrototypeOf(obj) === Object.prototype;
|
|
@@ -427,6 +427,19 @@ var NoteController = class {
|
|
|
427
427
|
else return this.proxy(id).get();
|
|
428
428
|
}
|
|
429
429
|
/**
|
|
430
|
+
* 根据 nid 获取日记,支持翻译参数
|
|
431
|
+
* @param nid 日记编号
|
|
432
|
+
* @param options 可选参数:password, single, lang
|
|
433
|
+
*/
|
|
434
|
+
getNoteByNid(nid, options) {
|
|
435
|
+
const { password, single, lang } = options || {};
|
|
436
|
+
return this.proxy.nid(nid.toString()).get({ params: {
|
|
437
|
+
password,
|
|
438
|
+
single: single ? "1" : void 0,
|
|
439
|
+
lang
|
|
440
|
+
} });
|
|
441
|
+
}
|
|
442
|
+
/**
|
|
430
443
|
* 日记列表分页
|
|
431
444
|
*/
|
|
432
445
|
getList(page = 1, perPage = 10, options = {}) {
|
|
@@ -515,10 +528,11 @@ var PostController = class {
|
|
|
515
528
|
* 获取文章列表分页
|
|
516
529
|
* @param page
|
|
517
530
|
* @param perPage
|
|
518
|
-
* @
|
|
531
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
532
|
+
* @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
|
|
519
533
|
*/
|
|
520
534
|
getList(page = 1, perPage = 10, options = {}) {
|
|
521
|
-
const { select, sortBy, sortOrder, year, truncate } = options;
|
|
535
|
+
const { select, sortBy, sortOrder, year, truncate, lang } = options;
|
|
522
536
|
return this.proxy.get({ params: {
|
|
523
537
|
page,
|
|
524
538
|
size: perPage,
|
|
@@ -526,12 +540,13 @@ var PostController = class {
|
|
|
526
540
|
sortBy,
|
|
527
541
|
sortOrder,
|
|
528
542
|
year,
|
|
529
|
-
truncate
|
|
543
|
+
truncate,
|
|
544
|
+
lang
|
|
530
545
|
} });
|
|
531
546
|
}
|
|
532
|
-
getPost(idOrCategoryName, slug) {
|
|
547
|
+
getPost(idOrCategoryName, slug, options) {
|
|
533
548
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
534
|
-
else return this.proxy(idOrCategoryName)(slug).get();
|
|
549
|
+
else return this.proxy(idOrCategoryName)(slug).get({ params: options?.lang ? { lang: options.lang } : void 0 });
|
|
535
550
|
}
|
|
536
551
|
/**
|
|
537
552
|
* 获取最新的文章
|
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-
|
|
1
|
+
import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DLzJOGbI.cjs";
|
|
2
2
|
|
|
3
3
|
//#region interfaces/controller.d.ts
|
|
4
4
|
interface IController {
|
|
@@ -174,6 +174,16 @@ interface TextBaseModel extends BaseCommentIndexModel {
|
|
|
174
174
|
type ModelWithLiked<T> = T & {
|
|
175
175
|
liked: boolean;
|
|
176
176
|
};
|
|
177
|
+
interface TranslationMeta {
|
|
178
|
+
sourceLang: string;
|
|
179
|
+
targetLang: string;
|
|
180
|
+
translatedAt: string;
|
|
181
|
+
}
|
|
182
|
+
type ModelWithTranslation<T> = T & {
|
|
183
|
+
isTranslated: boolean;
|
|
184
|
+
translationMeta?: TranslationMeta;
|
|
185
|
+
availableTranslations?: string[];
|
|
186
|
+
};
|
|
177
187
|
//#endregion
|
|
178
188
|
//#region models/post.d.ts
|
|
179
189
|
interface PostModel extends TextBaseModel {
|
|
@@ -374,6 +384,11 @@ interface NoteWrappedWithLikedPayload {
|
|
|
374
384
|
next?: Partial<NoteModel>;
|
|
375
385
|
prev?: Partial<NoteModel>;
|
|
376
386
|
}
|
|
387
|
+
interface NoteWrappedWithLikedAndTranslationPayload {
|
|
388
|
+
data: ModelWithLiked<ModelWithTranslation<NoteModel>>;
|
|
389
|
+
next?: Partial<NoteModel>;
|
|
390
|
+
prev?: Partial<NoteModel>;
|
|
391
|
+
}
|
|
377
392
|
//#endregion
|
|
378
393
|
//#region models/page.d.ts
|
|
379
394
|
declare enum EnumPageType {
|
|
@@ -1357,6 +1372,11 @@ type NoteListOptions = {
|
|
|
1357
1372
|
sortBy?: 'weather' | 'mood' | 'title' | 'created' | 'modified';
|
|
1358
1373
|
sortOrder?: 1 | -1;
|
|
1359
1374
|
};
|
|
1375
|
+
type NoteByNidOptions = {
|
|
1376
|
+
password?: string;
|
|
1377
|
+
single?: boolean;
|
|
1378
|
+
lang?: string;
|
|
1379
|
+
};
|
|
1360
1380
|
declare class NoteController<ResponseWrapper> implements IController {
|
|
1361
1381
|
private client;
|
|
1362
1382
|
base: string;
|
|
@@ -1384,6 +1404,12 @@ declare class NoteController<ResponseWrapper> implements IController {
|
|
|
1384
1404
|
getNoteById(id: number, password: string): Promise<NoteWrappedPayload>;
|
|
1385
1405
|
getNoteById(id: number, password: undefined, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
1386
1406
|
getNoteById(id: number, password: string, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
1407
|
+
/**
|
|
1408
|
+
* 根据 nid 获取日记,支持翻译参数
|
|
1409
|
+
* @param nid 日记编号
|
|
1410
|
+
* @param options 可选参数:password, single, lang
|
|
1411
|
+
*/
|
|
1412
|
+
getNoteByNid(nid: number, options?: NoteByNidOptions): RequestProxyResult<NoteWrappedWithLikedAndTranslationPayload, ResponseWrapper>;
|
|
1387
1413
|
/**
|
|
1388
1414
|
* 日记列表分页
|
|
1389
1415
|
*/
|
|
@@ -1496,7 +1522,13 @@ type PostListOptions = {
|
|
|
1496
1522
|
year?: number;
|
|
1497
1523
|
sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
|
|
1498
1524
|
sortOrder?: 1 | -1;
|
|
1499
|
-
truncate?: number;
|
|
1525
|
+
truncate?: number; /** 语言代码,用于获取翻译版本 */
|
|
1526
|
+
lang?: string;
|
|
1527
|
+
};
|
|
1528
|
+
/** 文章列表项,可能包含翻译信息 */
|
|
1529
|
+
type PostListItem = PostModel & {
|
|
1530
|
+
isTranslated?: boolean;
|
|
1531
|
+
translationMeta?: TranslationMeta;
|
|
1500
1532
|
};
|
|
1501
1533
|
declare class PostController<ResponseWrapper> implements IController {
|
|
1502
1534
|
private client;
|
|
@@ -1508,22 +1540,26 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
1508
1540
|
* 获取文章列表分页
|
|
1509
1541
|
* @param page
|
|
1510
1542
|
* @param perPage
|
|
1511
|
-
* @
|
|
1543
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
1544
|
+
* @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
|
|
1512
1545
|
*/
|
|
1513
|
-
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<
|
|
1546
|
+
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostListItem>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1514
1547
|
[key: string]: any;
|
|
1515
|
-
data: PaginateResult<
|
|
1548
|
+
data: PaginateResult<PostListItem>;
|
|
1516
1549
|
} : ResponseWrapper extends {
|
|
1517
|
-
data: PaginateResult<
|
|
1550
|
+
data: PaginateResult<PostListItem>;
|
|
1518
1551
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1519
|
-
data: PaginateResult<
|
|
1552
|
+
data: PaginateResult<PostListItem>;
|
|
1520
1553
|
}>;
|
|
1521
1554
|
/**
|
|
1522
1555
|
* 根据分类和路径查找文章
|
|
1523
1556
|
* @param categoryName
|
|
1524
1557
|
* @param slug
|
|
1558
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
1525
1559
|
*/
|
|
1526
|
-
getPost(categoryName: string, slug: string
|
|
1560
|
+
getPost(categoryName: string, slug: string, options?: {
|
|
1561
|
+
lang?: string;
|
|
1562
|
+
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
1527
1563
|
/**
|
|
1528
1564
|
* 根据 ID 查找文章
|
|
1529
1565
|
* @param id
|
|
@@ -2020,4 +2056,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
2020
2056
|
*/
|
|
2021
2057
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
2022
2058
|
//#endregion
|
|
2023
|
-
export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
2059
|
+
export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-
|
|
1
|
+
import { n as IRequestAdapter, r as RequestOptions, t as IAdaptorRequestResponseType } from "./adapter-DLzJOGbI.cjs";
|
|
2
2
|
|
|
3
3
|
//#region interfaces/controller.d.ts
|
|
4
4
|
interface IController {
|
|
@@ -174,6 +174,16 @@ interface TextBaseModel extends BaseCommentIndexModel {
|
|
|
174
174
|
type ModelWithLiked<T> = T & {
|
|
175
175
|
liked: boolean;
|
|
176
176
|
};
|
|
177
|
+
interface TranslationMeta {
|
|
178
|
+
sourceLang: string;
|
|
179
|
+
targetLang: string;
|
|
180
|
+
translatedAt: string;
|
|
181
|
+
}
|
|
182
|
+
type ModelWithTranslation<T> = T & {
|
|
183
|
+
isTranslated: boolean;
|
|
184
|
+
translationMeta?: TranslationMeta;
|
|
185
|
+
availableTranslations?: string[];
|
|
186
|
+
};
|
|
177
187
|
//#endregion
|
|
178
188
|
//#region models/post.d.ts
|
|
179
189
|
interface PostModel extends TextBaseModel {
|
|
@@ -374,6 +384,11 @@ interface NoteWrappedWithLikedPayload {
|
|
|
374
384
|
next?: Partial<NoteModel>;
|
|
375
385
|
prev?: Partial<NoteModel>;
|
|
376
386
|
}
|
|
387
|
+
interface NoteWrappedWithLikedAndTranslationPayload {
|
|
388
|
+
data: ModelWithLiked<ModelWithTranslation<NoteModel>>;
|
|
389
|
+
next?: Partial<NoteModel>;
|
|
390
|
+
prev?: Partial<NoteModel>;
|
|
391
|
+
}
|
|
377
392
|
//#endregion
|
|
378
393
|
//#region models/page.d.ts
|
|
379
394
|
declare enum EnumPageType {
|
|
@@ -1357,6 +1372,11 @@ type NoteListOptions = {
|
|
|
1357
1372
|
sortBy?: 'weather' | 'mood' | 'title' | 'created' | 'modified';
|
|
1358
1373
|
sortOrder?: 1 | -1;
|
|
1359
1374
|
};
|
|
1375
|
+
type NoteByNidOptions = {
|
|
1376
|
+
password?: string;
|
|
1377
|
+
single?: boolean;
|
|
1378
|
+
lang?: string;
|
|
1379
|
+
};
|
|
1360
1380
|
declare class NoteController<ResponseWrapper> implements IController {
|
|
1361
1381
|
private client;
|
|
1362
1382
|
base: string;
|
|
@@ -1384,6 +1404,12 @@ declare class NoteController<ResponseWrapper> implements IController {
|
|
|
1384
1404
|
getNoteById(id: number, password: string): Promise<NoteWrappedPayload>;
|
|
1385
1405
|
getNoteById(id: number, password: undefined, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
1386
1406
|
getNoteById(id: number, password: string, singleResult: true): Promise<RequestProxyResult<NoteModel, ResponseWrapper>>;
|
|
1407
|
+
/**
|
|
1408
|
+
* 根据 nid 获取日记,支持翻译参数
|
|
1409
|
+
* @param nid 日记编号
|
|
1410
|
+
* @param options 可选参数:password, single, lang
|
|
1411
|
+
*/
|
|
1412
|
+
getNoteByNid(nid: number, options?: NoteByNidOptions): RequestProxyResult<NoteWrappedWithLikedAndTranslationPayload, ResponseWrapper>;
|
|
1387
1413
|
/**
|
|
1388
1414
|
* 日记列表分页
|
|
1389
1415
|
*/
|
|
@@ -1496,7 +1522,13 @@ type PostListOptions = {
|
|
|
1496
1522
|
year?: number;
|
|
1497
1523
|
sortBy?: 'categoryId' | 'title' | 'created' | 'modified';
|
|
1498
1524
|
sortOrder?: 1 | -1;
|
|
1499
|
-
truncate?: number;
|
|
1525
|
+
truncate?: number; /** 语言代码,用于获取翻译版本 */
|
|
1526
|
+
lang?: string;
|
|
1527
|
+
};
|
|
1528
|
+
/** 文章列表项,可能包含翻译信息 */
|
|
1529
|
+
type PostListItem = PostModel & {
|
|
1530
|
+
isTranslated?: boolean;
|
|
1531
|
+
translationMeta?: TranslationMeta;
|
|
1500
1532
|
};
|
|
1501
1533
|
declare class PostController<ResponseWrapper> implements IController {
|
|
1502
1534
|
private client;
|
|
@@ -1508,22 +1540,26 @@ declare class PostController<ResponseWrapper> implements IController {
|
|
|
1508
1540
|
* 获取文章列表分页
|
|
1509
1541
|
* @param page
|
|
1510
1542
|
* @param perPage
|
|
1511
|
-
* @
|
|
1543
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
1544
|
+
* @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
|
|
1512
1545
|
*/
|
|
1513
|
-
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<
|
|
1546
|
+
getList(page?: number, perPage?: number, options?: PostListOptions): RequestProxyResult<PaginateResult<PostListItem>, ResponseWrapper, ResponseWrapper extends unknown ? {
|
|
1514
1547
|
[key: string]: any;
|
|
1515
|
-
data: PaginateResult<
|
|
1548
|
+
data: PaginateResult<PostListItem>;
|
|
1516
1549
|
} : ResponseWrapper extends {
|
|
1517
|
-
data: PaginateResult<
|
|
1550
|
+
data: PaginateResult<PostListItem>;
|
|
1518
1551
|
} ? ResponseWrapper : Omit<ResponseWrapper, "data"> & {
|
|
1519
|
-
data: PaginateResult<
|
|
1552
|
+
data: PaginateResult<PostListItem>;
|
|
1520
1553
|
}>;
|
|
1521
1554
|
/**
|
|
1522
1555
|
* 根据分类和路径查找文章
|
|
1523
1556
|
* @param categoryName
|
|
1524
1557
|
* @param slug
|
|
1558
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
1525
1559
|
*/
|
|
1526
|
-
getPost(categoryName: string, slug: string
|
|
1560
|
+
getPost(categoryName: string, slug: string, options?: {
|
|
1561
|
+
lang?: string;
|
|
1562
|
+
}): RequestProxyResult<ModelWithLiked<ModelWithTranslation<PostModel>>, ResponseWrapper>;
|
|
1527
1563
|
/**
|
|
1528
1564
|
* 根据 ID 查找文章
|
|
1529
1565
|
* @param id
|
|
@@ -2020,4 +2056,4 @@ declare const allControllerNames: readonly ["ai", "ack", "activity", "aggregate"
|
|
|
2020
2056
|
*/
|
|
2021
2057
|
declare const camelcaseKeys: <T = any>(obj: any) => T;
|
|
2022
2058
|
//#endregion
|
|
2023
|
-
export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
|
2059
|
+
export { AIController, AIDeepReadingModel, AISummaryModel, AckController, ActivityController, ActivityPresence, AdminExtraModel, AggregateAIConfig, AggregateController, AggregateRoot, AggregateRootWithTheme, AggregateStat, AggregateTop, AggregateTopNote, AggregateTopPost, AlgoliaSearchOptionsModel, AuthUser, BackupOptionsModel, BaiduSearchOptionsModel, BaseCommentIndexModel, BaseModel, BingSearchOptionsModel, CategoryController, CategoryEntries, CategoryModel, CategoryType, CategoryWithChildrenModel, CollectionRefTypes, CommentController, CommentDto, CommentModel, CommentOptionsModel, CommentRef, CommentState, Coordinate, Count, EnumPageType, type HTTPClient, IConfig, IConfigKeys, type IRequestAdapter, Image, LastYearPublication, LinkController, LinkModel, LinkState, LinkType, MailOptionsModel, ModelWithLiked, ModelWithTranslation, NoteController, NoteModel, NoteWrappedPayload, NoteWrappedWithLikedAndTranslationPayload, NoteWrappedWithLikedPayload, PageController, PageModel, Pager, PaginateResult, PostController, type PostListItem, type PostListOptions, PostModel, ProjectController, ProjectModel, ReaderModel, RecentActivities, RecentComment, RecentLike, RecentNote, RecentPost, RecentRecent, RecentlyAttitudeEnum, RecentlyAttitudeResultEnum, RecentlyController, RecentlyModel, RecentlyRefType, RecentlyRefTypes, RequestError, RoomOmittedNote, RoomOmittedPage, RoomOmittedPost, RoomsData, SayController, SayModel, SearchController, SeoOptionModel, ServerlessController, SnippetController, SnippetModel, SnippetType, SubscribeAllBit, SubscribeController, SubscribeNoteCreateBit, SubscribePostCreateBit, SubscribeRecentCreateBit, SubscribeSayCreateBit, SubscribeType, SubscribeTypeToBitMap, TLogin, TagModel, TextBaseModel, TimelineData, TimelineType, TopicController, TopicModel, TranslationMeta, Url, UrlOptionModel, UserController, UserModel, allControllerNames, allControllers, createClient, createClient as default, camelcaseKeys as simpleCamelcaseKeys };
|
package/dist/index.mjs
CHANGED
|
@@ -425,6 +425,19 @@ var NoteController = class {
|
|
|
425
425
|
else return this.proxy(id).get();
|
|
426
426
|
}
|
|
427
427
|
/**
|
|
428
|
+
* 根据 nid 获取日记,支持翻译参数
|
|
429
|
+
* @param nid 日记编号
|
|
430
|
+
* @param options 可选参数:password, single, lang
|
|
431
|
+
*/
|
|
432
|
+
getNoteByNid(nid, options) {
|
|
433
|
+
const { password, single, lang } = options || {};
|
|
434
|
+
return this.proxy.nid(nid.toString()).get({ params: {
|
|
435
|
+
password,
|
|
436
|
+
single: single ? "1" : void 0,
|
|
437
|
+
lang
|
|
438
|
+
} });
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
428
441
|
* 日记列表分页
|
|
429
442
|
*/
|
|
430
443
|
getList(page = 1, perPage = 10, options = {}) {
|
|
@@ -513,10 +526,11 @@ var PostController = class {
|
|
|
513
526
|
* 获取文章列表分页
|
|
514
527
|
* @param page
|
|
515
528
|
* @param perPage
|
|
516
|
-
* @
|
|
529
|
+
* @param options 可选参数,包含 lang 用于获取翻译版本
|
|
530
|
+
* @returns 当传入 lang 时,返回的文章可能包含 isTranslated 和 translationMeta 字段
|
|
517
531
|
*/
|
|
518
532
|
getList(page = 1, perPage = 10, options = {}) {
|
|
519
|
-
const { select, sortBy, sortOrder, year, truncate } = options;
|
|
533
|
+
const { select, sortBy, sortOrder, year, truncate, lang } = options;
|
|
520
534
|
return this.proxy.get({ params: {
|
|
521
535
|
page,
|
|
522
536
|
size: perPage,
|
|
@@ -524,12 +538,13 @@ var PostController = class {
|
|
|
524
538
|
sortBy,
|
|
525
539
|
sortOrder,
|
|
526
540
|
year,
|
|
527
|
-
truncate
|
|
541
|
+
truncate,
|
|
542
|
+
lang
|
|
528
543
|
} });
|
|
529
544
|
}
|
|
530
|
-
getPost(idOrCategoryName, slug) {
|
|
545
|
+
getPost(idOrCategoryName, slug, options) {
|
|
531
546
|
if (arguments.length == 1) return this.proxy(idOrCategoryName).get();
|
|
532
|
-
else return this.proxy(idOrCategoryName)(slug).get();
|
|
547
|
+
else return this.proxy(idOrCategoryName)(slug).get({ params: options?.lang ? { lang: options.lang } : void 0 });
|
|
533
548
|
}
|
|
534
549
|
/**
|
|
535
550
|
* 获取最新的文章
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mx-space/api-client",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.21.0",
|
|
4
4
|
"description": "A api client for mx-space server@next",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"engines": {
|
|
@@ -42,13 +42,6 @@
|
|
|
42
42
|
"tag": false,
|
|
43
43
|
"commit_message": "chore(release): bump @mx-space/api-client to v${NEW_VERSION}"
|
|
44
44
|
},
|
|
45
|
-
"scripts": {
|
|
46
|
-
"package": "rm -rf dist && tsdown && node mod-dts.mjs",
|
|
47
|
-
"build": "npm run package",
|
|
48
|
-
"prepackage": "rm -rf dist",
|
|
49
|
-
"test": "vitest",
|
|
50
|
-
"dev": "vitest"
|
|
51
|
-
},
|
|
52
45
|
"devDependencies": {
|
|
53
46
|
"@types/cors": "2.8.19",
|
|
54
47
|
"@types/express": "5.0.6",
|
|
@@ -63,5 +56,12 @@
|
|
|
63
56
|
"umi-request": "1.4.0",
|
|
64
57
|
"vite": "^7.3.1",
|
|
65
58
|
"vitest": "4.0.18"
|
|
59
|
+
},
|
|
60
|
+
"scripts": {
|
|
61
|
+
"package": "rm -rf dist && tsdown && node mod-dts.mjs",
|
|
62
|
+
"build": "npm run package",
|
|
63
|
+
"prepackage": "rm -rf dist",
|
|
64
|
+
"test": "vitest",
|
|
65
|
+
"dev": "vitest"
|
|
66
66
|
}
|
|
67
|
-
}
|
|
67
|
+
}
|
|
File without changes
|
|
File without changes
|