| 1 | <!doctype html> |
| 2 | <html lang="en"> |
| 3 | <head> |
| 4 | <meta charset="utf-8"> |
| 5 | <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1"> |
| 6 | <meta name="generator" content="pdoc3 0.11.6"> |
| 7 | <title>aioimmich.albums API documentation</title> |
| 8 | <meta name="description" content="aioimmich albums api."> |
| 9 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/sanitize.min.css" integrity="sha512-y1dtMcuvtTMJc1yPgEqF0ZjQbhnc/bFhyvIyVNb9Zk5mIGtqVaAB1Ttl28su8AvFMOY0EwRbAe+HCLqj6W7/KA==" crossorigin> |
| 10 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/10up-sanitize.css/13.0.0/typography.min.css" integrity="sha512-Y1DYSb995BAfxobCkKepB1BqJJTPrOp3zPL74AWFugHHmmdcvO+C48WLrUOlhGMc0QG7AE3f7gmvvcrmX2fDoA==" crossorigin> |
| 11 | <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/default.min.css" crossorigin> |
| 12 | <style>:root{--highlight-color:#fe9}.flex{display:flex !important}body{line-height:1.5em}#content{padding:20px}#sidebar{padding:1.5em;overflow:hidden}#sidebar > *:last-child{margin-bottom:2cm}.http-server-breadcrumbs{font-size:130%;margin:0 0 15px 0}#footer{font-size:.75em;padding:5px 30px;border-top:1px solid #ddd;text-align:right}#footer p{margin:0 0 0 1em;display:inline-block}#footer p:last-child{margin-right:30px}h1,h2,h3,h4,h5{font-weight:300}h1{font-size:2.5em;line-height:1.1em}h2{font-size:1.75em;margin:2em 0 .50em 0}h3{font-size:1.4em;margin:1.6em 0 .7em 0}h4{margin:0;font-size:105%}h1:target,h2:target,h3:target,h4:target,h5:target,h6:target{background:var(--highlight-color);padding:.2em 0}a{color:#058;text-decoration:none;transition:color .2s ease-in-out}a:visited{color:#503}a:hover{color:#b62}.title code{font-weight:bold}h2[id^="header-"]{margin-top:2em}.ident{color:#900;font-weight:bold}pre code{font-size:.8em;line-height:1.4em;padding:1em;display:block}code{background:#f3f3f3;font-family:"DejaVu Sans Mono",monospace;padding:1px 4px;overflow-wrap:break-word}h1 code{background:transparent}pre{border-top:1px solid #ccc;border-bottom:1px solid #ccc;margin:1em 0}#http-server-module-list{display:flex;flex-flow:column}#http-server-module-list div{display:flex}#http-server-module-list dt{min-width:10%}#http-server-module-list p{margin-top:0}.toc ul,#index{list-style-type:none;margin:0;padding:0}#index code{background:transparent}#index h3{border-bottom:1px solid #ddd}#index ul{padding:0}#index h4{margin-top:.6em;font-weight:bold}@media (min-width:200ex){#index .two-column{column-count:2}}@media (min-width:300ex){#index .two-column{column-count:3}}dl{margin-bottom:2em}dl dl:last-child{margin-bottom:4em}dd{margin:0 0 1em 3em}#header-classes + dl > dd{margin-bottom:3em}dd dd{margin-left:2em}dd p{margin:10px 0}.name{background:#eee;font-size:.85em;padding:5px 10px;display:inline-block;min-width:40%}.name:hover{background:#e0e0e0}dt:target .name{background:var(--highlight-color)}.name > span:first-child{white-space:nowrap}.name.class > span:nth-child(2){margin-left:.4em}.inherited{color:#999;border-left:5px solid #eee;padding-left:1em}.inheritance em{font-style:normal;font-weight:bold}.desc h2{font-weight:400;font-size:1.25em}.desc h3{font-size:1em}.desc dt code{background:inherit}.source > summary,.git-link-div{color:#666;text-align:right;font-weight:400;font-size:.8em;text-transform:uppercase}.source summary > *{white-space:nowrap;cursor:pointer}.git-link{color:inherit;margin-left:1em}.source pre{max-height:500px;overflow:auto;margin:0}.source pre code{font-size:12px;overflow:visible;min-width:max-content}.hlist{list-style:none}.hlist li{display:inline}.hlist li:after{content:',\2002'}.hlist li:last-child:after{content:none}.hlist .hlist{display:inline;padding-left:1em}img{max-width:100%}td{padding:0 .5em}.admonition{padding:.1em 1em;margin:1em 0}.admonition-title{font-weight:bold}.admonition.note,.admonition.info,.admonition.important{background:#aef}.admonition.todo,.admonition.versionadded,.admonition.tip,.admonition.hint{background:#dfd}.admonition.warning,.admonition.versionchanged,.admonition.deprecated{background:#fd4}.admonition.error,.admonition.danger,.admonition.caution{background:lightpink}</style> |
| 13 | <style media="screen and (min-width: 700px)">@media screen and (min-width:700px){#sidebar{width:30%;height:100vh;overflow:auto;position:sticky;top:0}#content{width:70%;max-width:100ch;padding:3em 4em;border-left:1px solid #ddd}pre code{font-size:1em}.name{font-size:1em}main{display:flex;flex-direction:row-reverse;justify-content:flex-end}.toc ul ul,#index ul ul{padding-left:1em}.toc > ul > li{margin-top:.5em}}</style> |
| 14 | <style media="print">@media print{#sidebar h1{page-break-before:always}.source{display:none}}@media print{*{background:transparent !important;color:#000 !important;box-shadow:none !important;text-shadow:none !important}a[href]:after{content:" (" attr(href) ")";font-size:90%}a[href][title]:after{content:none}abbr[title]:after{content:" (" attr(title) ")"}.ir a:after,a[href^="javascript:"]:after,a[href^="#"]:after{content:""}pre,blockquote{border:1px solid #999;page-break-inside:avoid}thead{display:table-header-group}tr,img{page-break-inside:avoid}img{max-width:100% !important}@page{margin:0.5cm}p,h2,h3{orphans:3;widows:3}h1,h2,h3,h4,h5,h6{page-break-after:avoid}}</style> |
| 15 | <script defer src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js" integrity="sha512-D9gUyxqja7hBtkWpPWGt9wfbfaMGVt9gnyCvYa+jojwwPHLCzUm5i8rpk7vD7wNee9bA35eYIjobYPaQuKS1MQ==" crossorigin></script> |
| 16 | <script>window.addEventListener('DOMContentLoaded', () => { |
| 17 | hljs.configure({languages: ['bash', 'css', 'diff', 'graphql', 'ini', 'javascript', 'json', 'plaintext', 'python', 'python-repl', 'rust', 'shell', 'sql', 'typescript', 'xml', 'yaml']}); |
| 18 | hljs.highlightAll(); |
| 19 | /* Collapse source docstrings */ |
| 20 | setTimeout(() => { |
| 21 | [...document.querySelectorAll('.hljs.language-python > .hljs-string')] |
| 22 | .filter(el => el.innerHTML.length > 200 && ['"""', "'''"].includes(el.innerHTML.substring(0, 3))) |
| 23 | .forEach(el => { |
| 24 | let d = document.createElement('details'); |
| 25 | d.classList.add('hljs-string'); |
| 26 | d.innerHTML = '<summary>"""</summary>' + el.innerHTML.substring(3); |
| 27 | el.replaceWith(d); |
| 28 | }); |
| 29 | }, 100); |
| 30 | })</script> |
| 31 | </head> |
| 32 | <body> |
| 33 | <main> |
| 34 | <article id="content"> |
| 35 | <header> |
| 36 | <h1 class="title">Module <code>aioimmich.albums</code></h1> |
| 37 | </header> |
| 38 | <section id="section-intro"> |
| 39 | <p>aioimmich albums api.</p> |
| 40 | </section> |
| 41 | <section> |
| 42 | <h2 class="section-title" id="header-submodules">Sub-modules</h2> |
| 43 | <dl> |
| 44 | <dt><code class="name"><a title="aioimmich.albums.models" href="models.html">aioimmich.albums.models</a></code></dt> |
| 45 | <dd> |
| 46 | <div class="desc"><p>aioimmich albums models.</p></div> |
| 47 | </dd> |
| 48 | </dl> |
| 49 | </section> |
| 50 | <section> |
| 51 | </section> |
| 52 | <section> |
| 53 | </section> |
| 54 | <section> |
| 55 | <h2 class="section-title" id="header-classes">Classes</h2> |
| 56 | <dl> |
| 57 | <dt id="aioimmich.albums.ImmichAlbums"><code class="flex name class"> |
| 58 | <span>class <span class="ident">ImmichAlbums</span></span> |
| 59 | <span>(</span><span>api: ImmichApi)</span> |
| 60 | </code></dt> |
| 61 | <dd> |
| 62 | <details class="source"> |
| 63 | <summary> |
| 64 | <span>Expand source code</span> |
| 65 | </summary> |
| 66 | <pre><code class="python">class ImmichAlbums(ImmichSubApi): |
| 67 | """Immich albums api.""" |
| 68 | |
| 69 | async def async_get_all_albums(self) -> list[ImmichAlbum]: |
| 70 | """Get all albums. |
| 71 | |
| 72 | Returns: |
| 73 | list of all albums as `list[ImmichAlbum]` |
| 74 | """ |
| 75 | if self.api.version.major < 3: |
| 76 | result = await self.api.async_do_request("albums", {"shared": "false"}) |
| 77 | assert isinstance(result, list) |
| 78 | result_shared = await self.api.async_do_request( |
| 79 | "albums", {"shared": "true"} |
| 80 | ) |
| 81 | assert isinstance(result_shared, list) |
| 82 | return [ImmichAlbum.from_dict(album) for album in result + result_shared] |
| 83 | |
| 84 | result = await self.api.async_do_request("albums") |
| 85 | assert isinstance(result, list) |
| 86 | return [ImmichAlbum.from_dict(album) for album in result] |
| 87 | |
| 88 | async def async_get_album_info(self, album_id: str) -> ImmichAlbum: |
| 89 | """Get album information. |
| 90 | |
| 91 | Args: |
| 92 | album_id (str): id of the album to be fetched |
| 93 | |
| 94 | Returns: |
| 95 | album as `ImmichAlbum` |
| 96 | """ |
| 97 | result = await self.api.async_do_request(f"albums/{album_id}") |
| 98 | assert isinstance(result, dict) |
| 99 | return ImmichAlbum.from_dict(result) |
| 100 | |
| 101 | async def async_filter_albums_by_name(self, name: str) -> list[ImmichAlbum]: |
| 102 | """Filter albums by name. |
| 103 | |
| 104 | Args: |
| 105 | name (str): Album name to filter by (case-insensitive) |
| 106 | |
| 107 | Returns: |
| 108 | a list of `ImmichAlbum` |
| 109 | """ |
| 110 | return [ |
| 111 | album |
| 112 | for album in await self.async_get_all_albums() |
| 113 | if name.lower() in album.album_name.lower() |
| 114 | ] |
| 115 | |
| 116 | async def async_add_assets_to_album( |
| 117 | self, album_id: str, asset_ids: list[str] |
| 118 | ) -> list[ImmichAddAssetsToAlbumResponse]: |
| 119 | """Add given assets to the given album. |
| 120 | |
| 121 | Args: |
| 122 | album_id (str): id of the album to add the assets |
| 123 | asset_ids (list): list of asset ids to add to the album |
| 124 | |
| 125 | Returns: |
| 126 | result of adding as list of `ImmichAddAssetsToAlbumResponse` |
| 127 | """ |
| 128 | result = await self.api.async_do_request( |
| 129 | f"albums/{album_id}/assets", data={"ids": asset_ids}, method="PUT" |
| 130 | ) |
| 131 | assert isinstance(result, list) |
| 132 | return [ImmichAddAssetsToAlbumResponse.from_dict(item) for item in result]</code></pre> |
| 133 | </details> |
| 134 | <div class="desc"><p>Immich albums api.</p> |
| 135 | <p>Immich sub api init.</p></div> |
| 136 | <h3>Ancestors</h3> |
| 137 | <ul class="hlist"> |
| 138 | <li><a title="aioimmich.api.ImmichSubApi" href="../api.html#aioimmich.api.ImmichSubApi">ImmichSubApi</a></li> |
| 139 | </ul> |
| 140 | <h3>Methods</h3> |
| 141 | <dl> |
| 142 | <dt id="aioimmich.albums.ImmichAlbums.async_add_assets_to_album"><code class="name flex"> |
| 143 | <span>async def <span class="ident">async_add_assets_to_album</span></span>(<span>self, album_id: str, asset_ids: list[str]) ‑> list[<a title="aioimmich.albums.models.ImmichAddAssetsToAlbumResponse" href="models.html#aioimmich.albums.models.ImmichAddAssetsToAlbumResponse">ImmichAddAssetsToAlbumResponse</a>]</span> |
| 144 | </code></dt> |
| 145 | <dd> |
| 146 | <details class="source"> |
| 147 | <summary> |
| 148 | <span>Expand source code</span> |
| 149 | </summary> |
| 150 | <pre><code class="python">async def async_add_assets_to_album( |
| 151 | self, album_id: str, asset_ids: list[str] |
| 152 | ) -> list[ImmichAddAssetsToAlbumResponse]: |
| 153 | """Add given assets to the given album. |
| 154 | |
| 155 | Args: |
| 156 | album_id (str): id of the album to add the assets |
| 157 | asset_ids (list): list of asset ids to add to the album |
| 158 | |
| 159 | Returns: |
| 160 | result of adding as list of `ImmichAddAssetsToAlbumResponse` |
| 161 | """ |
| 162 | result = await self.api.async_do_request( |
| 163 | f"albums/{album_id}/assets", data={"ids": asset_ids}, method="PUT" |
| 164 | ) |
| 165 | assert isinstance(result, list) |
| 166 | return [ImmichAddAssetsToAlbumResponse.from_dict(item) for item in result]</code></pre> |
| 167 | </details> |
| 168 | <div class="desc"><p>Add given assets to the given album.</p> |
| 169 | <dl> |
| 170 | <dt>Args</dt> |
| 171 | <dt>-----=</dt> |
| 172 | <dt><strong><code>album_id</code></strong> : <code>str</code></dt> |
| 173 | <dd>id of the album to add the assets</dd> |
| 174 | <dt><strong><code>asset_ids</code></strong> : <code>list</code></dt> |
| 175 | <dd>list of asset ids to add to the album</dd> |
| 176 | </dl> |
| 177 | <p>Returns |
| 178 | -----= |
| 179 | result of adding as list of <code>ImmichAddAssetsToAlbumResponse</code></p></div> |
| 180 | </dd> |
| 181 | <dt id="aioimmich.albums.ImmichAlbums.async_filter_albums_by_name"><code class="name flex"> |
| 182 | <span>async def <span class="ident">async_filter_albums_by_name</span></span>(<span>self, name: str) ‑> list[<a title="aioimmich.albums.models.ImmichAlbum" href="models.html#aioimmich.albums.models.ImmichAlbum">ImmichAlbum</a>]</span> |
| 183 | </code></dt> |
| 184 | <dd> |
| 185 | <details class="source"> |
| 186 | <summary> |
| 187 | <span>Expand source code</span> |
| 188 | </summary> |
| 189 | <pre><code class="python">async def async_filter_albums_by_name(self, name: str) -> list[ImmichAlbum]: |
| 190 | """Filter albums by name. |
| 191 | |
| 192 | Args: |
| 193 | name (str): Album name to filter by (case-insensitive) |
| 194 | |
| 195 | Returns: |
| 196 | a list of `ImmichAlbum` |
| 197 | """ |
| 198 | return [ |
| 199 | album |
| 200 | for album in await self.async_get_all_albums() |
| 201 | if name.lower() in album.album_name.lower() |
| 202 | ]</code></pre> |
| 203 | </details> |
| 204 | <div class="desc"><p>Filter albums by name.</p> |
| 205 | <dl> |
| 206 | <dt>Args</dt> |
| 207 | <dt>-----=</dt> |
| 208 | <dt><strong><code>name</code></strong> : <code>str</code></dt> |
| 209 | <dd>Album name to filter by (case-insensitive)</dd> |
| 210 | </dl> |
| 211 | <p>Returns |
| 212 | -----= |
| 213 | a list of <code>ImmichAlbum</code></p></div> |
| 214 | </dd> |
| 215 | <dt id="aioimmich.albums.ImmichAlbums.async_get_album_info"><code class="name flex"> |
| 216 | <span>async def <span class="ident">async_get_album_info</span></span>(<span>self, album_id: str) ‑> <a title="aioimmich.albums.models.ImmichAlbum" href="models.html#aioimmich.albums.models.ImmichAlbum">ImmichAlbum</a></span> |
| 217 | </code></dt> |
| 218 | <dd> |
| 219 | <details class="source"> |
| 220 | <summary> |
| 221 | <span>Expand source code</span> |
| 222 | </summary> |
| 223 | <pre><code class="python">async def async_get_album_info(self, album_id: str) -> ImmichAlbum: |
| 224 | """Get album information. |
| 225 | |
| 226 | Args: |
| 227 | album_id (str): id of the album to be fetched |
| 228 | |
| 229 | Returns: |
| 230 | album as `ImmichAlbum` |
| 231 | """ |
| 232 | result = await self.api.async_do_request(f"albums/{album_id}") |
| 233 | assert isinstance(result, dict) |
| 234 | return ImmichAlbum.from_dict(result)</code></pre> |
| 235 | </details> |
| 236 | <div class="desc"><p>Get album information.</p> |
| 237 | <dl> |
| 238 | <dt>Args</dt> |
| 239 | <dt>-----=</dt> |
| 240 | <dt><strong><code>album_id</code></strong> : <code>str</code></dt> |
| 241 | <dd>id of the album to be fetched</dd> |
| 242 | </dl> |
| 243 | <p>Returns |
| 244 | -----= |
| 245 | album as <code>ImmichAlbum</code></p></div> |
| 246 | </dd> |
| 247 | <dt id="aioimmich.albums.ImmichAlbums.async_get_all_albums"><code class="name flex"> |
| 248 | <span>async def <span class="ident">async_get_all_albums</span></span>(<span>self) ‑> list[<a title="aioimmich.albums.models.ImmichAlbum" href="models.html#aioimmich.albums.models.ImmichAlbum">ImmichAlbum</a>]</span> |
| 249 | </code></dt> |
| 250 | <dd> |
| 251 | <details class="source"> |
| 252 | <summary> |
| 253 | <span>Expand source code</span> |
| 254 | </summary> |
| 255 | <pre><code class="python">async def async_get_all_albums(self) -> list[ImmichAlbum]: |
| 256 | """Get all albums. |
| 257 | |
| 258 | Returns: |
| 259 | list of all albums as `list[ImmichAlbum]` |
| 260 | """ |
| 261 | if self.api.version.major < 3: |
| 262 | result = await self.api.async_do_request("albums", {"shared": "false"}) |
| 263 | assert isinstance(result, list) |
| 264 | result_shared = await self.api.async_do_request( |
| 265 | "albums", {"shared": "true"} |
| 266 | ) |
| 267 | assert isinstance(result_shared, list) |
| 268 | return [ImmichAlbum.from_dict(album) for album in result + result_shared] |
| 269 | |
| 270 | result = await self.api.async_do_request("albums") |
| 271 | assert isinstance(result, list) |
| 272 | return [ImmichAlbum.from_dict(album) for album in result]</code></pre> |
| 273 | </details> |
| 274 | <div class="desc"><p>Get all albums.</p> |
| 275 | <p>Returns |
| 276 | -----= |
| 277 | list of all albums as <code>list[ImmichAlbum]</code></p></div> |
| 278 | </dd> |
| 279 | </dl> |
| 280 | </dd> |
| 281 | </dl> |
| 282 | </section> |
| 283 | </article> |
| 284 | <nav id="sidebar"> |
| 285 | <div class="toc"> |
| 286 | <ul></ul> |
| 287 | </div> |
| 288 | <ul id="index"> |
| 289 | <li><h3>Super-module</h3> |
| 290 | <ul> |
| 291 | <li><code><a title="aioimmich" href="../index.html">aioimmich</a></code></li> |
| 292 | </ul> |
| 293 | </li> |
| 294 | <li><h3><a href="#header-submodules">Sub-modules</a></h3> |
| 295 | <ul> |
| 296 | <li><code><a title="aioimmich.albums.models" href="models.html">aioimmich.albums.models</a></code></li> |
| 297 | </ul> |
| 298 | </li> |
| 299 | <li><h3><a href="#header-classes">Classes</a></h3> |
| 300 | <ul> |
| 301 | <li> |
| 302 | <h4><code><a title="aioimmich.albums.ImmichAlbums" href="#aioimmich.albums.ImmichAlbums">ImmichAlbums</a></code></h4> |
| 303 | <ul class=""> |
| 304 | <li><code><a title="aioimmich.albums.ImmichAlbums.async_add_assets_to_album" href="#aioimmich.albums.ImmichAlbums.async_add_assets_to_album">async_add_assets_to_album</a></code></li> |
| 305 | <li><code><a title="aioimmich.albums.ImmichAlbums.async_filter_albums_by_name" href="#aioimmich.albums.ImmichAlbums.async_filter_albums_by_name">async_filter_albums_by_name</a></code></li> |
| 306 | <li><code><a title="aioimmich.albums.ImmichAlbums.async_get_album_info" href="#aioimmich.albums.ImmichAlbums.async_get_album_info">async_get_album_info</a></code></li> |
| 307 | <li><code><a title="aioimmich.albums.ImmichAlbums.async_get_all_albums" href="#aioimmich.albums.ImmichAlbums.async_get_all_albums">async_get_all_albums</a></code></li> |
| 308 | </ul> |
| 309 | </li> |
| 310 | </ul> |
| 311 | </li> |
| 312 | </ul> |
| 313 | </nav> |
| 314 | </main> |
| 315 | <footer id="footer"> |
| 316 | <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p> |
| 317 | </footer> |
| 318 | </body> |
| 319 | </html> |