@brigadasos/nadeshiko-sdk 1.4.2-dev.a13aba0 → 1.4.3-dev.09dcbc3

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
@@ -865,6 +865,11 @@ var createMedia = (options) => (options.client ?? client).post({
865
865
  ...options.headers
866
866
  }
867
867
  });
868
+ var autocompleteMedia = (options) => (options.client ?? client).get({
869
+ security: [{ scheme: "bearer", type: "http" }],
870
+ url: "/v1/media/autocomplete",
871
+ ...options
872
+ });
868
873
  var deleteMedia = (options) => (options.client ?? client).delete({
869
874
  security: [{ scheme: "bearer", type: "http" }],
870
875
  url: "/v1/media/{id}",
@@ -1034,7 +1039,7 @@ var getSeiyuu = (options) => (options.client ?? client).get({
1034
1039
  url: "/v1/media/seiyuu/{id}",
1035
1040
  ...options
1036
1041
  });
1037
- var getQuota = (options) => (options?.client ?? client).get({
1042
+ var getUserQuota = (options) => (options?.client ?? client).get({
1038
1043
  security: [{
1039
1044
  in: "cookie",
1040
1045
  name: "nadeshiko.session_token",
@@ -1043,7 +1048,7 @@ var getQuota = (options) => (options?.client ?? client).get({
1043
1048
  url: "/v1/user/quota",
1044
1049
  ...options
1045
1050
  });
1046
- var listReports = (options) => (options?.client ?? client).get({
1051
+ var listUserReports = (options) => (options?.client ?? client).get({
1047
1052
  security: [{
1048
1053
  in: "cookie",
1049
1054
  name: "nadeshiko.session_token",
@@ -1052,7 +1057,7 @@ var listReports = (options) => (options?.client ?? client).get({
1052
1057
  url: "/v1/user/reports",
1053
1058
  ...options
1054
1059
  });
1055
- var createReport = (options) => (options.client ?? client).post({
1060
+ var createUserReport = (options) => (options.client ?? client).post({
1056
1061
  security: [{
1057
1062
  in: "cookie",
1058
1063
  name: "nadeshiko.session_token",
@@ -1065,7 +1070,7 @@ var createReport = (options) => (options.client ?? client).post({
1065
1070
  ...options.headers
1066
1071
  }
1067
1072
  });
1068
- var getPreferences = (options) => (options?.client ?? client).get({
1073
+ var getUserPreferences = (options) => (options?.client ?? client).get({
1069
1074
  security: [{
1070
1075
  in: "cookie",
1071
1076
  name: "nadeshiko.session_token",
@@ -1074,7 +1079,7 @@ var getPreferences = (options) => (options?.client ?? client).get({
1074
1079
  url: "/v1/user/preferences",
1075
1080
  ...options
1076
1081
  });
1077
- var updatePreferences = (options) => (options.client ?? client).patch({
1082
+ var updateUserPreferences = (options) => (options.client ?? client).patch({
1078
1083
  security: [{
1079
1084
  in: "cookie",
1080
1085
  name: "nadeshiko.session_token",
@@ -1087,7 +1092,7 @@ var updatePreferences = (options) => (options.client ?? client).patch({
1087
1092
  ...options.headers
1088
1093
  }
1089
1094
  });
1090
- var deleteActivity = (options) => (options?.client ?? client).delete({
1095
+ var deleteUserActivity = (options) => (options?.client ?? client).delete({
1091
1096
  security: [{
1092
1097
  in: "cookie",
1093
1098
  name: "nadeshiko.session_token",
@@ -1096,7 +1101,7 @@ var deleteActivity = (options) => (options?.client ?? client).delete({
1096
1101
  url: "/v1/user/activity",
1097
1102
  ...options
1098
1103
  });
1099
- var listActivity = (options) => (options?.client ?? client).get({
1104
+ var listUserActivity = (options) => (options?.client ?? client).get({
1100
1105
  security: [{
1101
1106
  in: "cookie",
1102
1107
  name: "nadeshiko.session_token",
@@ -1105,7 +1110,7 @@ var listActivity = (options) => (options?.client ?? client).get({
1105
1110
  url: "/v1/user/activity",
1106
1111
  ...options
1107
1112
  });
1108
- var getActivityHeatmap = (options) => (options?.client ?? client).get({
1113
+ var getUserActivityHeatmap = (options) => (options?.client ?? client).get({
1109
1114
  security: [{
1110
1115
  in: "cookie",
1111
1116
  name: "nadeshiko.session_token",
@@ -1114,7 +1119,7 @@ var getActivityHeatmap = (options) => (options?.client ?? client).get({
1114
1119
  url: "/v1/user/activity/heatmap",
1115
1120
  ...options
1116
1121
  });
1117
- var getActivityStats = (options) => (options?.client ?? client).get({
1122
+ var getUserActivityStats = (options) => (options?.client ?? client).get({
1118
1123
  security: [{
1119
1124
  in: "cookie",
1120
1125
  name: "nadeshiko.session_token",
@@ -1123,7 +1128,7 @@ var getActivityStats = (options) => (options?.client ?? client).get({
1123
1128
  url: "/v1/user/activity/stats",
1124
1129
  ...options
1125
1130
  });
1126
- var exportData = (options) => (options?.client ?? client).get({
1131
+ var exportUserData = (options) => (options?.client ?? client).get({
1127
1132
  security: [{
1128
1133
  in: "cookie",
1129
1134
  name: "nadeshiko.session_token",
@@ -1132,7 +1137,7 @@ var exportData = (options) => (options?.client ?? client).get({
1132
1137
  url: "/v1/user/export",
1133
1138
  ...options
1134
1139
  });
1135
- var listLabs = (options) => (options?.client ?? client).get({
1140
+ var listUserLabs = (options) => (options?.client ?? client).get({
1136
1141
  security: [{
1137
1142
  in: "cookie",
1138
1143
  name: "nadeshiko.session_token",
@@ -1341,11 +1346,23 @@ var environments = {
1341
1346
  DEVELOPMENT: "https://api.dev.brigadasos.xyz/api",
1342
1347
  PRODUCTION: "https://api.brigadasos.xyz/api"
1343
1348
  };
1349
+ var defaultSessionTokenGetter = () => {
1350
+ if (typeof document === "undefined")
1351
+ return;
1352
+ const match = document.cookie.match(/(?:^|;\s*)nadeshiko\.session_token=([^;]*)/);
1353
+ return match ? decodeURIComponent(match[1]) : undefined;
1354
+ };
1344
1355
  function createNadeshikoClient(config) {
1345
1356
  const baseUrl = config.baseUrl ? config.baseUrl in environments ? environments[config.baseUrl] : config.baseUrl : environments.PRODUCTION;
1357
+ const getSessionToken = config.sessionToken ?? defaultSessionTokenGetter;
1346
1358
  const clientInstance = createClient(createConfig({
1347
1359
  baseUrl,
1348
- headers: { Authorization: `Bearer ${config.apiKey}` }
1360
+ auth: (auth) => {
1361
+ if (auth.in === "cookie") {
1362
+ return getSessionToken();
1363
+ }
1364
+ return config.apiKey;
1365
+ }
1349
1366
  }));
1350
1367
  return {
1351
1368
  client: clientInstance,
@@ -1363,7 +1380,7 @@ function createNadeshikoClient(config) {
1363
1380
  getSeries: (options) => getSeries({ ...options, client: clientInstance }),
1364
1381
  getCharacter: (options) => getCharacter({ ...options, client: clientInstance }),
1365
1382
  getSeiyuu: (options) => getSeiyuu({ ...options, client: clientInstance }),
1366
- getQuota: (options) => getQuota({ ...options, client: clientInstance }),
1383
+ getUserQuota: (options) => getUserQuota({ ...options, client: clientInstance }),
1367
1384
  listCollections: (options) => listCollections({ ...options, client: clientInstance }),
1368
1385
  createCollection: (options) => createCollection({ ...options, client: clientInstance }),
1369
1386
  getCollection: (options) => getCollection({ ...options, client: clientInstance }),
@@ -1389,6 +1406,7 @@ function createNadeshikoClient(config) {
1389
1406
  createAdminReviewAllowlistEntry: (options) => createAdminReviewAllowlistEntry({ ...options, client: clientInstance }),
1390
1407
  deleteAdminReviewAllowlistEntry: (options) => deleteAdminReviewAllowlistEntry({ ...options, client: clientInstance }),
1391
1408
  createMedia: (options) => createMedia({ ...options, client: clientInstance }),
1409
+ autocompleteMedia: (options) => autocompleteMedia({ ...options, client: clientInstance }),
1392
1410
  updateMedia: (options) => updateMedia({ ...options, client: clientInstance }),
1393
1411
  deleteMedia: (options) => deleteMedia({ ...options, client: clientInstance }),
1394
1412
  createEpisode: (options) => createEpisode({ ...options, client: clientInstance }),
@@ -1404,21 +1422,20 @@ function createNadeshikoClient(config) {
1404
1422
  addMediaToSeries: (options) => addMediaToSeries({ ...options, client: clientInstance }),
1405
1423
  updateSeriesMedia: (options) => updateSeriesMedia({ ...options, client: clientInstance }),
1406
1424
  removeMediaFromSeries: (options) => removeMediaFromSeries({ ...options, client: clientInstance }),
1407
- createReport: (options) => createReport({ ...options, client: clientInstance }),
1408
- listReports: (options) => listReports({ ...options, client: clientInstance }),
1409
- getPreferences: (options) => getPreferences({ ...options, client: clientInstance }),
1410
- updatePreferences: (options) => updatePreferences({ ...options, client: clientInstance }),
1411
- listActivity: (options) => listActivity({ ...options, client: clientInstance }),
1412
- deleteActivity: (options) => deleteActivity({ ...options, client: clientInstance }),
1413
- getActivityHeatmap: (options) => getActivityHeatmap({ ...options, client: clientInstance }),
1414
- getActivityStats: (options) => getActivityStats({ ...options, client: clientInstance }),
1415
- exportData: (options) => exportData({ ...options, client: clientInstance }),
1416
- listLabs: (options) => listLabs({ ...options, client: clientInstance }),
1425
+ createUserReport: (options) => createUserReport({ ...options, client: clientInstance }),
1426
+ listUserReports: (options) => listUserReports({ ...options, client: clientInstance }),
1427
+ getUserPreferences: (options) => getUserPreferences({ ...options, client: clientInstance }),
1428
+ updateUserPreferences: (options) => updateUserPreferences({ ...options, client: clientInstance }),
1429
+ listUserActivity: (options) => listUserActivity({ ...options, client: clientInstance }),
1430
+ deleteUserActivity: (options) => deleteUserActivity({ ...options, client: clientInstance }),
1431
+ getUserActivityHeatmap: (options) => getUserActivityHeatmap({ ...options, client: clientInstance }),
1432
+ getUserActivityStats: (options) => getUserActivityStats({ ...options, client: clientInstance }),
1433
+ exportUserData: (options) => exportUserData({ ...options, client: clientInstance }),
1434
+ listUserLabs: (options) => listUserLabs({ ...options, client: clientInstance }),
1417
1435
  getAdminDashboard: (options) => getAdminDashboard({ ...options, client: clientInstance }),
1418
1436
  getAdminHealth: (options) => getAdminHealth({ ...options, client: clientInstance })
1419
1437
  };
1420
1438
  }
1421
- var createClient2 = createNadeshikoClient;
1422
1439
  // generated/dev/internal/media.gen.ts
1423
1440
  var exports_media_gen = {};
1424
1441
  __export(exports_media_gen, {
@@ -1437,21 +1454,22 @@ __export(exports_media_gen, {
1437
1454
  createSegment: () => createSegment,
1438
1455
  createMedia: () => createMedia,
1439
1456
  createEpisode: () => createEpisode,
1457
+ autocompleteMedia: () => autocompleteMedia,
1440
1458
  addMediaToSeries: () => addMediaToSeries
1441
1459
  });
1442
1460
  // generated/dev/internal/user.gen.ts
1443
1461
  var exports_user_gen = {};
1444
1462
  __export(exports_user_gen, {
1445
- updatePreferences: () => updatePreferences,
1446
- listReports: () => listReports,
1447
- listLabs: () => listLabs,
1448
- listActivity: () => listActivity,
1449
- getPreferences: () => getPreferences,
1450
- getActivityStats: () => getActivityStats,
1451
- getActivityHeatmap: () => getActivityHeatmap,
1452
- exportData: () => exportData,
1453
- deleteActivity: () => deleteActivity,
1454
- createReport: () => createReport
1463
+ updateUserPreferences: () => updateUserPreferences,
1464
+ listUserReports: () => listUserReports,
1465
+ listUserLabs: () => listUserLabs,
1466
+ listUserActivity: () => listUserActivity,
1467
+ getUserPreferences: () => getUserPreferences,
1468
+ getUserActivityStats: () => getUserActivityStats,
1469
+ getUserActivityHeatmap: () => getUserActivityHeatmap,
1470
+ exportUserData: () => exportUserData,
1471
+ deleteUserActivity: () => deleteUserActivity,
1472
+ createUserReport: () => createUserReport
1455
1473
  });
1456
1474
  // generated/dev/internal/admin.gen.ts
1457
1475
  var exports_admin_gen = {};
@@ -1461,10 +1479,10 @@ __export(exports_admin_gen, {
1461
1479
  });
1462
1480
  export {
1463
1481
  exports_user_gen as user,
1482
+ updateUserPreferences,
1464
1483
  updateSeriesMedia,
1465
1484
  updateSeries,
1466
1485
  updateSegment,
1467
- updatePreferences,
1468
1486
  updateMedia,
1469
1487
  updateEpisode,
1470
1488
  updateCollectionSegment,
@@ -1480,11 +1498,12 @@ export {
1480
1498
  removeMediaFromSeries,
1481
1499
  purgeAdminQueueFailed,
1482
1500
  exports_media_gen as media,
1501
+ listUserReports,
1502
+ listUserLabs,
1503
+ listUserActivity,
1483
1504
  listSeries,
1484
1505
  listSegments,
1485
- listReports,
1486
1506
  listMedia,
1487
- listLabs,
1488
1507
  listEpisodes,
1489
1508
  listCollections,
1490
1509
  listAdminReviewRuns,
@@ -1493,15 +1512,16 @@ export {
1493
1512
  listAdminReports,
1494
1513
  listAdminQueueStats,
1495
1514
  listAdminQueueFailed,
1496
- listActivity,
1515
+ getUserQuota,
1516
+ getUserPreferences,
1517
+ getUserActivityStats,
1518
+ getUserActivityHeatmap,
1497
1519
  getSeries,
1498
1520
  getSeiyuu,
1499
1521
  getSegmentContext,
1500
1522
  getSegmentByUuid,
1501
1523
  getSegment,
1502
1524
  getSearchStats,
1503
- getQuota,
1504
- getPreferences,
1505
1525
  getMedia,
1506
1526
  getEpisode,
1507
1527
  getCollection,
@@ -1510,30 +1530,28 @@ export {
1510
1530
  getAdminQueue,
1511
1531
  getAdminHealth,
1512
1532
  getAdminDashboard,
1513
- getActivityStats,
1514
- getActivityHeatmap,
1515
- exportData,
1533
+ exportUserData,
1534
+ deleteUserActivity,
1516
1535
  deleteSeries,
1517
1536
  deleteSegment,
1518
1537
  deleteMedia,
1519
1538
  deleteEpisode,
1520
1539
  deleteCollection,
1521
1540
  deleteAdminReviewAllowlistEntry,
1522
- deleteActivity,
1541
+ createUserReport,
1523
1542
  createSeries,
1524
1543
  createSegment,
1525
- createReport,
1526
1544
  createNadeshikoClient,
1527
1545
  createMedia,
1528
1546
  createEpisode,
1529
1547
  createCollection,
1530
- createClient2 as createClient,
1531
1548
  createAdminReviewAllowlistEntry,
1532
1549
  client,
1550
+ autocompleteMedia,
1533
1551
  exports_admin_gen as admin,
1534
1552
  addSegmentToCollection,
1535
1553
  addMediaToSeries
1536
1554
  };
1537
1555
 
1538
- //# debugId=6DCBA6AB10BC445664756E2164756E21
1556
+ //# debugId=AB5963794BD4F67864756E2164756E21
1539
1557
  //# sourceMappingURL=index.js.map