@book000/pixivts 0.64.0-beta.8 → 0.64.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.js CHANGED
@@ -1190,6 +1190,16 @@ var IllustResource = class {
1190
1190
  })), this.#http, (page) => page.illusts);
1191
1191
  }
1192
1192
  /**
1193
+ * Fetches illusts posted by the authenticated account's mypixiv (mutual
1194
+ * follow) users.
1195
+ * GET /v2/illust/mypixiv
1196
+ *
1197
+ * @param params - Request parameters
1198
+ */
1199
+ mypixiv(params = {}) {
1200
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v2/illust/mypixiv", buildParams({ offset: params.offset })), this.#http, (page) => page.illusts);
1201
+ }
1202
+ /**
1193
1203
  * Fetches comments posted on an illust.
1194
1204
  * GET /v3/illust/comments
1195
1205
  *
@@ -1285,6 +1295,18 @@ function parseWebviewNovel(html) {
1285
1295
  }
1286
1296
  //#endregion
1287
1297
  //#region src/resources/novels.ts
1298
+ /**
1299
+ * Formats a view timestamp as ISO 8601 with milliseconds and the local UTC
1300
+ * offset of that instant. Strings are returned unchanged.
1301
+ */
1302
+ function formatViewedAt(value) {
1303
+ if (typeof value === "string") return value;
1304
+ const pad = (n, width = 2) => String(n).padStart(width, "0");
1305
+ const offsetMinutes = -value.getTimezoneOffset();
1306
+ const sign = offsetMinutes < 0 ? "-" : "+";
1307
+ const absOffset = Math.abs(offsetMinutes);
1308
+ return `${value.getFullYear()}-${pad(value.getMonth() + 1)}-${pad(value.getDate())}T${pad(value.getHours())}:${pad(value.getMinutes())}:${pad(value.getSeconds())}.${pad(value.getMilliseconds(), 3)}${sign}${pad(Math.floor(absOffset / 60))}:${pad(absOffset % 60)}`;
1309
+ }
1288
1310
  /** Methods for the novel API namespace. */
1289
1311
  var NovelResource = class {
1290
1312
  #http;
@@ -1424,18 +1446,27 @@ var NovelResource = class {
1424
1446
  }
1425
1447
  /**
1426
1448
  * Fetches recommended novels.
1427
- * GET /v1/novel/recommended
1449
+ * GET /v1/novel/recommended, or POST /v1/novel/recommended when
1450
+ * `params.viewed` is non-empty.
1428
1451
  *
1429
1452
  * @param params - Request parameters
1430
1453
  */
1431
1454
  recommended(params = {}) {
1432
- return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/novel/recommended", buildParams({
1455
+ const path = "/v1/novel/recommended";
1456
+ const query = {
1433
1457
  filter: params.filter ?? "for_ios",
1434
1458
  includeRankingNovels: true,
1435
1459
  includePrivacyPolicy: true,
1436
1460
  offset: params.offset,
1437
1461
  maxBookmarkIdForRecommend: params.maxBookmarkIdForRecommend
1438
- })), this.#http, (page) => page.novels);
1462
+ };
1463
+ const viewed = params.viewed ?? [];
1464
+ const first = viewed.length > 0 ? this.#http.post(path, buildParams({
1465
+ ...query,
1466
+ viewNovelIds: viewed.map((entry) => entry.id),
1467
+ viewNovelDatetimes: viewed.map((entry) => formatViewedAt(entry.viewedAt))
1468
+ }).toString()) : this.#http.get(path, buildParams(query));
1469
+ return PaginatedResultAsync.fromResultAsync(first, this.#http, (page) => page.novels);
1439
1470
  }
1440
1471
  /**
1441
1472
  * Fetches a novel series.
@@ -1450,6 +1481,24 @@ var NovelResource = class {
1450
1481
  })), this.#http, (page) => page.novels);
1451
1482
  }
1452
1483
  /**
1484
+ * Fetches the authenticated user's novel series watchlist.
1485
+ * GET /v1/watchlist/novel
1486
+ *
1487
+ * Takes no parameters; later pages follow the server-provided `next_url`.
1488
+ */
1489
+ watchlist() {
1490
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/watchlist/novel"), this.#http, (page) => page.series);
1491
+ }
1492
+ /**
1493
+ * Fetches the novels with a saved reading position (marker).
1494
+ * GET /v2/novel/markers
1495
+ *
1496
+ * Takes no parameters; later pages follow the server-provided `next_url`.
1497
+ */
1498
+ markers() {
1499
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v2/novel/markers"), this.#http, (page) => page.markedNovels);
1500
+ }
1501
+ /**
1453
1502
  * Adds a novel bookmark.
1454
1503
  * POST /v2/novel/bookmark/add
1455
1504
  *
@@ -1474,6 +1523,18 @@ var NovelResource = class {
1474
1523
  return this.#http.post("/v1/novel/bookmark/delete", body.toString());
1475
1524
  }
1476
1525
  /**
1526
+ * Fetches the users who bookmarked a novel.
1527
+ * GET /v1/novel/bookmark/users
1528
+ *
1529
+ * @param params - Request parameters
1530
+ */
1531
+ bookmarkUsers(params) {
1532
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/novel/bookmark/users", buildParams({
1533
+ novelId: params.novelId,
1534
+ offset: params.offset
1535
+ })), this.#http, (page) => page.users);
1536
+ }
1537
+ /**
1477
1538
  * Fetches novels posted by users the authenticated account follows.
1478
1539
  * GET /v1/novel/follow
1479
1540
  *
@@ -1486,6 +1547,19 @@ var NovelResource = class {
1486
1547
  })), this.#http, (page) => page.novels);
1487
1548
  }
1488
1549
  /**
1550
+ * Fetches novels posted by the authenticated account's mypixiv (mutual
1551
+ * follow) users.
1552
+ * GET /v1/novel/mypixiv
1553
+ *
1554
+ * The endpoint ignores `offset`. Paginate with `maxNovelId`, or follow
1555
+ * `next_url` via `.pages()` / `.items()`.
1556
+ *
1557
+ * @param params - Request parameters
1558
+ */
1559
+ mypixiv(params = {}) {
1560
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/novel/mypixiv", buildParams({ maxNovelId: params.maxNovelId })), this.#http, (page) => page.novels);
1561
+ }
1562
+ /**
1489
1563
  * Fetches comments posted on a novel.
1490
1564
  * GET /v3/novel/comments
1491
1565
  *
@@ -1798,6 +1872,28 @@ var UserResource = class {
1798
1872
  })), this.#http, (page) => page.bookmarkTags);
1799
1873
  }
1800
1874
  /**
1875
+ * Fetches a user's novel bookmark tags, with the number of bookmarks under each tag.
1876
+ * GET /v1/user/bookmark-tags/novel
1877
+ *
1878
+ * @param params - Request parameters
1879
+ */
1880
+ bookmarkTagsNovel(params) {
1881
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/user/bookmark-tags/novel", buildParams({
1882
+ userId: params.userId,
1883
+ restrict: params.restrict ?? "public",
1884
+ offset: params.offset
1885
+ })), this.#http, (page) => page.bookmarkTags);
1886
+ }
1887
+ /**
1888
+ * Fetches whether the authenticated user follows a user, and with which visibility.
1889
+ * GET /v1/user/follow/detail
1890
+ *
1891
+ * @param params - Request parameters
1892
+ */
1893
+ followDetail(params) {
1894
+ return this.#http.get("/v1/user/follow/detail", buildParams({ userId: params.userId }));
1895
+ }
1896
+ /**
1801
1897
  * Edits the authenticated user's AI-generated-work display setting.
1802
1898
  * POST /v1/user/ai-show-settings/edit
1803
1899
  *
@@ -1807,6 +1903,41 @@ var UserResource = class {
1807
1903
  const body = buildParams({ setting: params.setting });
1808
1904
  return this.#http.post("/v1/user/ai-show-settings/edit", body.toString());
1809
1905
  }
1906
+ /**
1907
+ * Fetches the authenticated user's AI-generated-work display setting.
1908
+ * GET /v1/user/ai-show-settings
1909
+ */
1910
+ aiShowSettings() {
1911
+ return this.#http.get("/v1/user/ai-show-settings");
1912
+ }
1913
+ /**
1914
+ * Fetches the authenticated user's restricted-mode setting.
1915
+ * GET /v1/user/restricted-mode-settings
1916
+ */
1917
+ restrictedModeSettings() {
1918
+ return this.#http.get("/v1/user/restricted-mode-settings");
1919
+ }
1920
+ /**
1921
+ * Fetches the authenticated user's mute list.
1922
+ * GET /v1/mute/list
1923
+ */
1924
+ muteList() {
1925
+ return this.#http.get("/v1/mute/list");
1926
+ }
1927
+ /**
1928
+ * Fetches the authenticated user's account state and profile.
1929
+ * GET /v1/user/me/state
1930
+ */
1931
+ meState() {
1932
+ return this.#http.get("/v1/user/me/state");
1933
+ }
1934
+ /**
1935
+ * Fetches whether the authenticated user has unread notifications.
1936
+ * GET /v1/notification/has-unread-notifications
1937
+ */
1938
+ hasUnreadNotifications() {
1939
+ return this.#http.get("/v1/notification/has-unread-notifications");
1940
+ }
1810
1941
  };
1811
1942
  //#endregion
1812
1943
  //#region src/resources/manga.ts
@@ -1830,6 +1961,15 @@ var MangaResource = class {
1830
1961
  offset: params.offset
1831
1962
  })), this.#http, (page) => page.illusts);
1832
1963
  }
1964
+ /**
1965
+ * Fetches the authenticated user's manga series watchlist.
1966
+ * GET /v1/watchlist/manga
1967
+ *
1968
+ * Takes no parameters; later pages follow the server-provided `next_url`.
1969
+ */
1970
+ watchlist() {
1971
+ return PaginatedResultAsync.fromResultAsync(this.#http.get("/v1/watchlist/manga"), this.#http, (page) => page.series);
1972
+ }
1833
1973
  };
1834
1974
  //#endregion
1835
1975
  //#region src/resources/ugoira.ts