@immich/sdk 1.138.1 → 2.2.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.
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Immich
3
- * 1.138.1
3
+ * 2.2.0
4
4
  * DO NOT MODIFY - This file has been generated using oazapfts.
5
5
  * See https://www.npmjs.com/package/oazapfts
6
6
  */
@@ -164,6 +164,14 @@ export function restoreUserAdmin({ id }, opts) {
164
164
  method: "POST"
165
165
  }));
166
166
  }
167
+ /**
168
+ * This endpoint is an admin-only route, and requires the `adminSession.read` permission.
169
+ */
170
+ export function getUserSessionsAdmin({ id }, opts) {
171
+ return oazapfts.ok(oazapfts.fetchJson(`/admin/users/${encodeURIComponent(id)}/sessions`, {
172
+ ...opts
173
+ }));
174
+ }
167
175
  /**
168
176
  * This endpoint is an admin-only route, and requires the `adminUser.read` permission.
169
177
  */
@@ -197,6 +205,19 @@ export function createAlbum({ createAlbumDto }, opts) {
197
205
  body: createAlbumDto
198
206
  })));
199
207
  }
208
+ /**
209
+ * This endpoint requires the `albumAsset.create` permission.
210
+ */
211
+ export function addAssetsToAlbums({ key, slug, albumsAddAssetsDto }, opts) {
212
+ return oazapfts.ok(oazapfts.fetchJson(`/albums/assets${QS.query(QS.explode({
213
+ key,
214
+ slug
215
+ }))}`, oazapfts.json({
216
+ ...opts,
217
+ method: "PUT",
218
+ body: albumsAddAssetsDto
219
+ })));
220
+ }
200
221
  /**
201
222
  * This endpoint requires the `album.statistics` permission.
202
223
  */
@@ -306,6 +327,11 @@ export function createApiKey({ apiKeyCreateDto }, opts) {
306
327
  body: apiKeyCreateDto
307
328
  })));
308
329
  }
330
+ export function getMyApiKey(opts) {
331
+ return oazapfts.ok(oazapfts.fetchJson("/api-keys/me", {
332
+ ...opts
333
+ }));
334
+ }
309
335
  /**
310
336
  * This endpoint requires the `apiKey.delete` permission.
311
337
  */
@@ -379,6 +405,16 @@ export function checkBulkUpload({ assetBulkUploadCheckDto }, opts) {
379
405
  body: assetBulkUploadCheckDto
380
406
  })));
381
407
  }
408
+ /**
409
+ * This endpoint requires the `asset.copy` permission.
410
+ */
411
+ export function copyAsset({ assetCopyDto }, opts) {
412
+ return oazapfts.ok(oazapfts.fetchText("/assets/copy", oazapfts.json({
413
+ ...opts,
414
+ method: "PUT",
415
+ body: assetCopyDto
416
+ })));
417
+ }
382
418
  /**
383
419
  * getAllUserAssetsByDeviceId
384
420
  */
@@ -447,6 +483,49 @@ export function updateAsset({ id, updateAssetDto }, opts) {
447
483
  body: updateAssetDto
448
484
  })));
449
485
  }
486
+ /**
487
+ * This endpoint requires the `asset.read` permission.
488
+ */
489
+ export function getAssetMetadata({ id }, opts) {
490
+ return oazapfts.ok(oazapfts.fetchJson(`/assets/${encodeURIComponent(id)}/metadata`, {
491
+ ...opts
492
+ }));
493
+ }
494
+ /**
495
+ * This endpoint requires the `asset.update` permission.
496
+ */
497
+ export function updateAssetMetadata({ id, assetMetadataUpsertDto }, opts) {
498
+ return oazapfts.ok(oazapfts.fetchJson(`/assets/${encodeURIComponent(id)}/metadata`, oazapfts.json({
499
+ ...opts,
500
+ method: "PUT",
501
+ body: assetMetadataUpsertDto
502
+ })));
503
+ }
504
+ /**
505
+ * This endpoint requires the `asset.update` permission.
506
+ */
507
+ export function deleteAssetMetadata({ id, key }, opts) {
508
+ return oazapfts.ok(oazapfts.fetchText(`/assets/${encodeURIComponent(id)}/metadata/${encodeURIComponent(key)}`, {
509
+ ...opts,
510
+ method: "DELETE"
511
+ }));
512
+ }
513
+ /**
514
+ * This endpoint requires the `asset.read` permission.
515
+ */
516
+ export function getAssetMetadataByKey({ id, key }, opts) {
517
+ return oazapfts.ok(oazapfts.fetchJson(`/assets/${encodeURIComponent(id)}/metadata/${encodeURIComponent(key)}`, {
518
+ ...opts
519
+ }));
520
+ }
521
+ /**
522
+ * This endpoint requires the `asset.read` permission.
523
+ */
524
+ export function getAssetOcr({ id }, opts) {
525
+ return oazapfts.ok(oazapfts.fetchJson(`/assets/${encodeURIComponent(id)}/ocr`, {
526
+ ...opts
527
+ }));
528
+ }
450
529
  /**
451
530
  * This endpoint requires the `asset.download` permission.
452
531
  */
@@ -459,7 +538,7 @@ export function downloadAsset({ id, key, slug }, opts) {
459
538
  }));
460
539
  }
461
540
  /**
462
- * replaceAsset
541
+ * Replace the asset with new file, without changing its id
463
542
  */
464
543
  export function replaceAsset({ id, key, slug, assetMediaReplaceDto }, opts) {
465
544
  return oazapfts.ok(oazapfts.fetchJson(`/assets/${encodeURIComponent(id)}/original${QS.query(QS.explode({
@@ -973,6 +1052,16 @@ export function getPartners({ direction }, opts) {
973
1052
  ...opts
974
1053
  }));
975
1054
  }
1055
+ /**
1056
+ * This endpoint requires the `partner.create` permission.
1057
+ */
1058
+ export function createPartner({ partnerCreateDto }, opts) {
1059
+ return oazapfts.ok(oazapfts.fetchJson("/partners", oazapfts.json({
1060
+ ...opts,
1061
+ method: "POST",
1062
+ body: partnerCreateDto
1063
+ })));
1064
+ }
976
1065
  /**
977
1066
  * This endpoint requires the `partner.delete` permission.
978
1067
  */
@@ -983,9 +1072,9 @@ export function removePartner({ id }, opts) {
983
1072
  }));
984
1073
  }
985
1074
  /**
986
- * This endpoint requires the `partner.create` permission.
1075
+ * This property was deprecated in v1.141.0. This endpoint requires the `partner.create` permission.
987
1076
  */
988
- export function createPartner({ id }, opts) {
1077
+ export function createPartnerDeprecated({ id }, opts) {
989
1078
  return oazapfts.ok(oazapfts.fetchJson(`/partners/${encodeURIComponent(id)}`, {
990
1079
  ...opts,
991
1080
  method: "POST"
@@ -994,11 +1083,11 @@ export function createPartner({ id }, opts) {
994
1083
  /**
995
1084
  * This endpoint requires the `partner.update` permission.
996
1085
  */
997
- export function updatePartner({ id, updatePartnerDto }, opts) {
1086
+ export function updatePartner({ id, partnerUpdateDto }, opts) {
998
1087
  return oazapfts.ok(oazapfts.fetchJson(`/partners/${encodeURIComponent(id)}`, oazapfts.json({
999
1088
  ...opts,
1000
1089
  method: "PUT",
1001
- body: updatePartnerDto
1090
+ body: partnerUpdateDto
1002
1091
  })));
1003
1092
  }
1004
1093
  /**
@@ -1127,7 +1216,7 @@ export function getExploreData(opts) {
1127
1216
  /**
1128
1217
  * This endpoint requires the `asset.read` permission.
1129
1218
  */
1130
- export function searchLargeAssets({ albumIds, city, country, createdAfter, createdBefore, deviceId, isEncoded, isFavorite, isMotion, isNotInAlbum, isOffline, lensModel, libraryId, make, minFileSize, model, personIds, rating, size, state, tagIds, takenAfter, takenBefore, trashedAfter, trashedBefore, $type, updatedAfter, updatedBefore, visibility, withDeleted, withExif }, opts) {
1219
+ export function searchLargeAssets({ albumIds, city, country, createdAfter, createdBefore, deviceId, isEncoded, isFavorite, isMotion, isNotInAlbum, isOffline, lensModel, libraryId, make, minFileSize, model, ocr, personIds, rating, size, state, tagIds, takenAfter, takenBefore, trashedAfter, trashedBefore, $type, updatedAfter, updatedBefore, visibility, withDeleted, withExif }, opts) {
1131
1220
  return oazapfts.ok(oazapfts.fetchJson(`/search/large-assets${QS.query(QS.explode({
1132
1221
  albumIds,
1133
1222
  city,
@@ -1145,6 +1234,7 @@ export function searchLargeAssets({ albumIds, city, country, createdAfter, creat
1145
1234
  make,
1146
1235
  minFileSize,
1147
1236
  model,
1237
+ ocr,
1148
1238
  personIds,
1149
1239
  rating,
1150
1240
  size,
@@ -1229,10 +1319,11 @@ export function searchAssetStatistics({ statisticsSearchDto }, opts) {
1229
1319
  /**
1230
1320
  * This endpoint requires the `asset.read` permission.
1231
1321
  */
1232
- export function getSearchSuggestions({ country, includeNull, make, model, state, $type }, opts) {
1322
+ export function getSearchSuggestions({ country, includeNull, lensModel, make, model, state, $type }, opts) {
1233
1323
  return oazapfts.ok(oazapfts.fetchJson(`/search/suggestions${QS.query(QS.explode({
1234
1324
  country,
1235
1325
  includeNull,
1326
+ lensModel,
1236
1327
  make,
1237
1328
  model,
1238
1329
  state,
@@ -1749,7 +1840,7 @@ export function tagAssets({ id, bulkIdsDto }, opts) {
1749
1840
  /**
1750
1841
  * This endpoint requires the `asset.read` permission.
1751
1842
  */
1752
- export function getTimeBucket({ albumId, isFavorite, isTrashed, key, order, personId, slug, tagId, timeBucket, userId, visibility, withPartners, withStacked }, opts) {
1843
+ export function getTimeBucket({ albumId, isFavorite, isTrashed, key, order, personId, slug, tagId, timeBucket, userId, visibility, withCoordinates, withPartners, withStacked }, opts) {
1753
1844
  return oazapfts.ok(oazapfts.fetchJson(`/timeline/bucket${QS.query(QS.explode({
1754
1845
  albumId,
1755
1846
  isFavorite,
@@ -1762,6 +1853,7 @@ export function getTimeBucket({ albumId, isFavorite, isTrashed, key, order, pers
1762
1853
  timeBucket,
1763
1854
  userId,
1764
1855
  visibility,
1856
+ withCoordinates,
1765
1857
  withPartners,
1766
1858
  withStacked
1767
1859
  }))}`, {
@@ -1771,7 +1863,7 @@ export function getTimeBucket({ albumId, isFavorite, isTrashed, key, order, pers
1771
1863
  /**
1772
1864
  * This endpoint requires the `asset.read` permission.
1773
1865
  */
1774
- export function getTimeBuckets({ albumId, isFavorite, isTrashed, key, order, personId, slug, tagId, userId, visibility, withPartners, withStacked }, opts) {
1866
+ export function getTimeBuckets({ albumId, isFavorite, isTrashed, key, order, personId, slug, tagId, userId, visibility, withCoordinates, withPartners, withStacked }, opts) {
1775
1867
  return oazapfts.ok(oazapfts.fetchJson(`/timeline/buckets${QS.query(QS.explode({
1776
1868
  albumId,
1777
1869
  isFavorite,
@@ -1783,6 +1875,7 @@ export function getTimeBuckets({ albumId, isFavorite, isTrashed, key, order, per
1783
1875
  tagId,
1784
1876
  userId,
1785
1877
  visibility,
1878
+ withCoordinates,
1786
1879
  withPartners,
1787
1880
  withStacked
1788
1881
  }))}`, {
@@ -1997,6 +2090,8 @@ export var NotificationType;
1997
2090
  NotificationType["JobFailed"] = "JobFailed";
1998
2091
  NotificationType["BackupFailed"] = "BackupFailed";
1999
2092
  NotificationType["SystemMessage"] = "SystemMessage";
2093
+ NotificationType["AlbumInvite"] = "AlbumInvite";
2094
+ NotificationType["AlbumUpdate"] = "AlbumUpdate";
2000
2095
  NotificationType["Custom"] = "Custom";
2001
2096
  })(NotificationType || (NotificationType = {}));
2002
2097
  export var UserStatus;
@@ -2035,6 +2130,13 @@ export var AssetTypeEnum;
2035
2130
  AssetTypeEnum["Audio"] = "AUDIO";
2036
2131
  AssetTypeEnum["Other"] = "OTHER";
2037
2132
  })(AssetTypeEnum || (AssetTypeEnum = {}));
2133
+ export var BulkIdErrorReason;
2134
+ (function (BulkIdErrorReason) {
2135
+ BulkIdErrorReason["Duplicate"] = "duplicate";
2136
+ BulkIdErrorReason["NoPermission"] = "no_permission";
2137
+ BulkIdErrorReason["NotFound"] = "not_found";
2138
+ BulkIdErrorReason["Unknown"] = "unknown";
2139
+ })(BulkIdErrorReason || (BulkIdErrorReason = {}));
2038
2140
  export var Error;
2039
2141
  (function (Error) {
2040
2142
  Error["Duplicate"] = "duplicate";
@@ -2063,6 +2165,7 @@ export var Permission;
2063
2165
  Permission["AssetDownload"] = "asset.download";
2064
2166
  Permission["AssetUpload"] = "asset.upload";
2065
2167
  Permission["AssetReplace"] = "asset.replace";
2168
+ Permission["AssetCopy"] = "asset.copy";
2066
2169
  Permission["AlbumCreate"] = "album.create";
2067
2170
  Permission["AlbumRead"] = "album.read";
2068
2171
  Permission["AlbumUpdate"] = "album.update";
@@ -2171,8 +2274,13 @@ export var Permission;
2171
2274
  Permission["AdminUserRead"] = "adminUser.read";
2172
2275
  Permission["AdminUserUpdate"] = "adminUser.update";
2173
2276
  Permission["AdminUserDelete"] = "adminUser.delete";
2277
+ Permission["AdminSessionRead"] = "adminSession.read";
2174
2278
  Permission["AdminAuthUnlinkAll"] = "adminAuth.unlinkAll";
2175
2279
  })(Permission || (Permission = {}));
2280
+ export var AssetMetadataKey;
2281
+ (function (AssetMetadataKey) {
2282
+ AssetMetadataKey["MobileApp"] = "mobile-app";
2283
+ })(AssetMetadataKey || (AssetMetadataKey = {}));
2176
2284
  export var AssetMediaStatus;
2177
2285
  (function (AssetMediaStatus) {
2178
2286
  AssetMediaStatus["Created"] = "created";
@@ -2228,6 +2336,7 @@ export var JobName;
2228
2336
  JobName["Library"] = "library";
2229
2337
  JobName["Notifications"] = "notifications";
2230
2338
  JobName["BackupDatabase"] = "backupDatabase";
2339
+ JobName["Ocr"] = "ocr";
2231
2340
  })(JobName || (JobName = {}));
2232
2341
  export var JobCommand;
2233
2342
  (function (JobCommand) {
@@ -2253,6 +2362,7 @@ export var SearchSuggestionType;
2253
2362
  SearchSuggestionType["City"] = "city";
2254
2363
  SearchSuggestionType["CameraMake"] = "camera-make";
2255
2364
  SearchSuggestionType["CameraModel"] = "camera-model";
2365
+ SearchSuggestionType["CameraLensModel"] = "camera-lens-model";
2256
2366
  })(SearchSuggestionType || (SearchSuggestionType = {}));
2257
2367
  export var SharedLinkType;
2258
2368
  (function (SharedLinkType) {
@@ -2273,6 +2383,8 @@ export var SyncEntityType;
2273
2383
  SyncEntityType["AssetV1"] = "AssetV1";
2274
2384
  SyncEntityType["AssetDeleteV1"] = "AssetDeleteV1";
2275
2385
  SyncEntityType["AssetExifV1"] = "AssetExifV1";
2386
+ SyncEntityType["AssetMetadataV1"] = "AssetMetadataV1";
2387
+ SyncEntityType["AssetMetadataDeleteV1"] = "AssetMetadataDeleteV1";
2276
2388
  SyncEntityType["PartnerV1"] = "PartnerV1";
2277
2389
  SyncEntityType["PartnerDeleteV1"] = "PartnerDeleteV1";
2278
2390
  SyncEntityType["PartnerAssetV1"] = "PartnerAssetV1";
@@ -2311,6 +2423,7 @@ export var SyncEntityType;
2311
2423
  SyncEntityType["UserMetadataDeleteV1"] = "UserMetadataDeleteV1";
2312
2424
  SyncEntityType["SyncAckV1"] = "SyncAckV1";
2313
2425
  SyncEntityType["SyncResetV1"] = "SyncResetV1";
2426
+ SyncEntityType["SyncCompleteV1"] = "SyncCompleteV1";
2314
2427
  })(SyncEntityType || (SyncEntityType = {}));
2315
2428
  export var SyncRequestType;
2316
2429
  (function (SyncRequestType) {
@@ -2321,6 +2434,7 @@ export var SyncRequestType;
2321
2434
  SyncRequestType["AlbumAssetExifsV1"] = "AlbumAssetExifsV1";
2322
2435
  SyncRequestType["AssetsV1"] = "AssetsV1";
2323
2436
  SyncRequestType["AssetExifsV1"] = "AssetExifsV1";
2437
+ SyncRequestType["AssetMetadataV1"] = "AssetMetadataV1";
2324
2438
  SyncRequestType["AuthUsersV1"] = "AuthUsersV1";
2325
2439
  SyncRequestType["MemoriesV1"] = "MemoriesV1";
2326
2440
  SyncRequestType["MemoryToAssetsV1"] = "MemoryToAssetsV1";
package/build/index.d.ts CHANGED
@@ -3,11 +3,14 @@ export * from './fetch-errors.js';
3
3
  export interface InitOptions {
4
4
  baseUrl: string;
5
5
  apiKey: string;
6
+ headers?: Record<string, string>;
6
7
  }
7
- export declare const init: ({ baseUrl, apiKey }: InitOptions) => void;
8
+ export declare const init: ({ baseUrl, apiKey, headers }: InitOptions) => void;
8
9
  export declare const getBaseUrl: () => string;
9
10
  export declare const setBaseUrl: (baseUrl: string) => void;
10
11
  export declare const setApiKey: (apiKey: string) => void;
12
+ export declare const setHeader: (key: string, value: string) => void;
13
+ export declare const setHeaders: (headers: Record<string, string>) => void;
11
14
  export declare const getAssetOriginalPath: (id: string) => string;
12
15
  export declare const getAssetThumbnailPath: (id: string) => string;
13
16
  export declare const getAssetPlaybackPath: (id: string) => string;
package/build/index.js CHANGED
@@ -1,9 +1,12 @@
1
1
  import { defaults } from './fetch-client.js';
2
2
  export * from './fetch-client.js';
3
3
  export * from './fetch-errors.js';
4
- export const init = ({ baseUrl, apiKey }) => {
4
+ export const init = ({ baseUrl, apiKey, headers }) => {
5
5
  setBaseUrl(baseUrl);
6
6
  setApiKey(apiKey);
7
+ if (headers) {
8
+ setHeaders(headers);
9
+ }
7
10
  };
8
11
  export const getBaseUrl = () => defaults.baseUrl;
9
12
  export const setBaseUrl = (baseUrl) => {
@@ -13,6 +16,23 @@ export const setApiKey = (apiKey) => {
13
16
  defaults.headers = defaults.headers || {};
14
17
  defaults.headers['x-api-key'] = apiKey;
15
18
  };
19
+ export const setHeader = (key, value) => {
20
+ assertNoApiKey(key);
21
+ defaults.headers = defaults.headers || {};
22
+ defaults.headers[key] = value;
23
+ };
24
+ export const setHeaders = (headers) => {
25
+ defaults.headers = defaults.headers || {};
26
+ for (const [key, value] of Object.entries(headers)) {
27
+ assertNoApiKey(key);
28
+ defaults.headers[key] = value;
29
+ }
30
+ };
31
+ const assertNoApiKey = (headerKey) => {
32
+ if (headerKey.toLowerCase() === 'x-api-key') {
33
+ throw new Error('The API key header can only be set using setApiKey().');
34
+ }
35
+ };
16
36
  export const getAssetOriginalPath = (id) => `/assets/${id}/original`;
17
37
  export const getAssetThumbnailPath = (id) => `/assets/${id}/thumbnail`;
18
38
  export const getAssetPlaybackPath = (id) => `/assets/${id}/video/playback`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@immich/sdk",
3
- "version": "1.138.1",
3
+ "version": "2.2.0",
4
4
  "description": "Auto-generated TypeScript SDK for the Immich API",
5
5
  "type": "module",
6
6
  "main": "./build/index.js",
@@ -11,15 +11,12 @@
11
11
  "default": "./build/index.js"
12
12
  }
13
13
  },
14
- "scripts": {
15
- "build": "tsc"
16
- },
17
14
  "license": "GNU Affero General Public License version 3",
18
15
  "dependencies": {
19
16
  "@oazapfts/runtime": "^1.0.2"
20
17
  },
21
18
  "devDependencies": {
22
- "@types/node": "^22.17.0",
19
+ "@types/node": "^22.18.12",
23
20
  "typescript": "^5.3.3"
24
21
  },
25
22
  "repository": {
@@ -28,6 +25,9 @@
28
25
  "directory": "open-api/typescript-sdk"
29
26
  },
30
27
  "volta": {
31
- "node": "22.18.0"
28
+ "node": "24.11.0"
29
+ },
30
+ "scripts": {
31
+ "build": "tsc"
32
32
  }
33
- }
33
+ }