| 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.people API documentation</title> |
| 8 | <meta name="description" content="aioimmich people 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.people</code></h1> |
| 37 | </header> |
| 38 | <section id="section-intro"> |
| 39 | <p>aioimmich people 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.people.models" href="models.html">aioimmich.people.models</a></code></dt> |
| 45 | <dd> |
| 46 | <div class="desc"><p>aioimmich people 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.people.ImmichPeople"><code class="flex name class"> |
| 58 | <span>class <span class="ident">ImmichPeople</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 ImmichPeople(ImmichSubApi): |
| 67 | """Immich tags api.""" |
| 68 | |
| 69 | async def async_get_all_people( |
| 70 | self, with_unnamed: bool = False, page_size: int = 200, max_pages: int = 10 |
| 71 | ) -> list[ImmichPerson]: |
| 72 | """Get all people. |
| 73 | |
| 74 | Args: |
| 75 | page_size (int): assets per page |
| 76 | max_pages (int): maximum number of pages to return |
| 77 | |
| 78 | Returns: |
| 79 | all people as list of `ImmichPerson` |
| 80 | """ |
| 81 | results: list[ImmichPerson] = [] |
| 82 | for page in range(max_pages): |
| 83 | result = await self.api.async_do_request( |
| 84 | "people", params={"size": page_size, "page": page + 1} |
| 85 | ) |
| 86 | assert isinstance(result, dict) |
| 87 | people = result["people"] |
| 88 | results.extend( |
| 89 | ImmichPerson.from_dict(person) |
| 90 | for person in people |
| 91 | if person["name"] or with_unnamed |
| 92 | ) |
| 93 | if not result.get("hasNextPage"): |
| 94 | break |
| 95 | |
| 96 | return results |
| 97 | |
| 98 | async def async_get_person_by_id(self, person_id: str) -> ImmichPerson: |
| 99 | """Get a specific person by its uuid. |
| 100 | |
| 101 | Args: |
| 102 | person_id (str): Person ID |
| 103 | |
| 104 | Returns: |
| 105 | `ImmichPerson` |
| 106 | """ |
| 107 | result = await self.api.async_do_request(f"people/{person_id}") |
| 108 | assert isinstance(result, dict) |
| 109 | return ImmichPerson.from_dict(result) |
| 110 | |
| 111 | async def async_filter_people_by_name(self, name: str) -> list[ImmichPerson]: |
| 112 | """Filter people by name. |
| 113 | |
| 114 | Args: |
| 115 | name (str): People name to filter by (case-insensitive) |
| 116 | |
| 117 | Returns: |
| 118 | a list of `ImmichPerson` |
| 119 | """ |
| 120 | return [ |
| 121 | person |
| 122 | for person in await self.async_get_all_people(max_pages=50) |
| 123 | if name.lower() in person.name.lower() |
| 124 | ] |
| 125 | |
| 126 | async def async_get_people_count(self) -> int: |
| 127 | """Get the total count of all people. |
| 128 | |
| 129 | Returns: |
| 130 | total count of all people as `int` |
| 131 | """ |
| 132 | result = await self.api.async_do_request( |
| 133 | "people", |
| 134 | params={ |
| 135 | "size": 1, |
| 136 | }, |
| 137 | ) |
| 138 | assert isinstance(result, dict) |
| 139 | return int(result["total"]) |
| 140 | |
| 141 | async def async_get_person_thumbnail(self, person_id: str) -> bytes: |
| 142 | """Download thumbnail for a person. |
| 143 | |
| 144 | Args: |
| 145 | person_id (str): id of the person to fetch the thumbnail for |
| 146 | |
| 147 | Returns: |
| 148 | persons thumbnail as `bytes` |
| 149 | """ |
| 150 | result = await self.api.async_do_request( |
| 151 | f"people/{person_id}/thumbnail", application="octet-stream" |
| 152 | ) |
| 153 | assert isinstance(result, bytes) |
| 154 | return result</code></pre> |
| 155 | </details> |
| 156 | <div class="desc"><p>Immich tags api.</p> |
| 157 | <p>Immich sub api init.</p></div> |
| 158 | <h3>Ancestors</h3> |
| 159 | <ul class="hlist"> |
| 160 | <li><a title="aioimmich.api.ImmichSubApi" href="../api.html#aioimmich.api.ImmichSubApi">ImmichSubApi</a></li> |
| 161 | </ul> |
| 162 | <h3>Methods</h3> |
| 163 | <dl> |
| 164 | <dt id="aioimmich.people.ImmichPeople.async_filter_people_by_name"><code class="name flex"> |
| 165 | <span>async def <span class="ident">async_filter_people_by_name</span></span>(<span>self, name: str) ‑> list[<a title="aioimmich.people.models.ImmichPerson" href="models.html#aioimmich.people.models.ImmichPerson">ImmichPerson</a>]</span> |
| 166 | </code></dt> |
| 167 | <dd> |
| 168 | <details class="source"> |
| 169 | <summary> |
| 170 | <span>Expand source code</span> |
| 171 | </summary> |
| 172 | <pre><code class="python">async def async_filter_people_by_name(self, name: str) -> list[ImmichPerson]: |
| 173 | """Filter people by name. |
| 174 | |
| 175 | Args: |
| 176 | name (str): People name to filter by (case-insensitive) |
| 177 | |
| 178 | Returns: |
| 179 | a list of `ImmichPerson` |
| 180 | """ |
| 181 | return [ |
| 182 | person |
| 183 | for person in await self.async_get_all_people(max_pages=50) |
| 184 | if name.lower() in person.name.lower() |
| 185 | ]</code></pre> |
| 186 | </details> |
| 187 | <div class="desc"><p>Filter people by name.</p> |
| 188 | <dl> |
| 189 | <dt>Args</dt> |
| 190 | <dt>-----=</dt> |
| 191 | <dt><strong><code>name</code></strong> : <code>str</code></dt> |
| 192 | <dd>People name to filter by (case-insensitive)</dd> |
| 193 | </dl> |
| 194 | <p>Returns |
| 195 | -----= |
| 196 | a list of <code>ImmichPerson</code></p></div> |
| 197 | </dd> |
| 198 | <dt id="aioimmich.people.ImmichPeople.async_get_all_people"><code class="name flex"> |
| 199 | <span>async def <span class="ident">async_get_all_people</span></span>(<span>self, with_unnamed: bool = False, page_size: int = 200, max_pages: int = 10) ‑> list[<a title="aioimmich.people.models.ImmichPerson" href="models.html#aioimmich.people.models.ImmichPerson">ImmichPerson</a>]</span> |
| 200 | </code></dt> |
| 201 | <dd> |
| 202 | <details class="source"> |
| 203 | <summary> |
| 204 | <span>Expand source code</span> |
| 205 | </summary> |
| 206 | <pre><code class="python">async def async_get_all_people( |
| 207 | self, with_unnamed: bool = False, page_size: int = 200, max_pages: int = 10 |
| 208 | ) -> list[ImmichPerson]: |
| 209 | """Get all people. |
| 210 | |
| 211 | Args: |
| 212 | page_size (int): assets per page |
| 213 | max_pages (int): maximum number of pages to return |
| 214 | |
| 215 | Returns: |
| 216 | all people as list of `ImmichPerson` |
| 217 | """ |
| 218 | results: list[ImmichPerson] = [] |
| 219 | for page in range(max_pages): |
| 220 | result = await self.api.async_do_request( |
| 221 | "people", params={"size": page_size, "page": page + 1} |
| 222 | ) |
| 223 | assert isinstance(result, dict) |
| 224 | people = result["people"] |
| 225 | results.extend( |
| 226 | ImmichPerson.from_dict(person) |
| 227 | for person in people |
| 228 | if person["name"] or with_unnamed |
| 229 | ) |
| 230 | if not result.get("hasNextPage"): |
| 231 | break |
| 232 | |
| 233 | return results</code></pre> |
| 234 | </details> |
| 235 | <div class="desc"><p>Get all people.</p> |
| 236 | <dl> |
| 237 | <dt>Args</dt> |
| 238 | <dt>-----=</dt> |
| 239 | <dt><strong><code>page_size</code></strong> : <code>int</code></dt> |
| 240 | <dd>assets per page</dd> |
| 241 | <dt><strong><code>max_pages</code></strong> : <code>int</code></dt> |
| 242 | <dd>maximum number of pages to return</dd> |
| 243 | </dl> |
| 244 | <p>Returns |
| 245 | -----= |
| 246 | all people as list of <code>ImmichPerson</code></p></div> |
| 247 | </dd> |
| 248 | <dt id="aioimmich.people.ImmichPeople.async_get_people_count"><code class="name flex"> |
| 249 | <span>async def <span class="ident">async_get_people_count</span></span>(<span>self) ‑> int</span> |
| 250 | </code></dt> |
| 251 | <dd> |
| 252 | <details class="source"> |
| 253 | <summary> |
| 254 | <span>Expand source code</span> |
| 255 | </summary> |
| 256 | <pre><code class="python">async def async_get_people_count(self) -> int: |
| 257 | """Get the total count of all people. |
| 258 | |
| 259 | Returns: |
| 260 | total count of all people as `int` |
| 261 | """ |
| 262 | result = await self.api.async_do_request( |
| 263 | "people", |
| 264 | params={ |
| 265 | "size": 1, |
| 266 | }, |
| 267 | ) |
| 268 | assert isinstance(result, dict) |
| 269 | return int(result["total"])</code></pre> |
| 270 | </details> |
| 271 | <div class="desc"><p>Get the total count of all people.</p> |
| 272 | <p>Returns |
| 273 | -----= |
| 274 | total count of all people as <code>int</code></p></div> |
| 275 | </dd> |
| 276 | <dt id="aioimmich.people.ImmichPeople.async_get_person_by_id"><code class="name flex"> |
| 277 | <span>async def <span class="ident">async_get_person_by_id</span></span>(<span>self, person_id: str) ‑> <a title="aioimmich.people.models.ImmichPerson" href="models.html#aioimmich.people.models.ImmichPerson">ImmichPerson</a></span> |
| 278 | </code></dt> |
| 279 | <dd> |
| 280 | <details class="source"> |
| 281 | <summary> |
| 282 | <span>Expand source code</span> |
| 283 | </summary> |
| 284 | <pre><code class="python">async def async_get_person_by_id(self, person_id: str) -> ImmichPerson: |
| 285 | """Get a specific person by its uuid. |
| 286 | |
| 287 | Args: |
| 288 | person_id (str): Person ID |
| 289 | |
| 290 | Returns: |
| 291 | `ImmichPerson` |
| 292 | """ |
| 293 | result = await self.api.async_do_request(f"people/{person_id}") |
| 294 | assert isinstance(result, dict) |
| 295 | return ImmichPerson.from_dict(result)</code></pre> |
| 296 | </details> |
| 297 | <div class="desc"><p>Get a specific person by its uuid.</p> |
| 298 | <dl> |
| 299 | <dt>Args</dt> |
| 300 | <dt>-----=</dt> |
| 301 | <dt><strong><code>person_id</code></strong> : <code>str</code></dt> |
| 302 | <dd>Person ID</dd> |
| 303 | </dl> |
| 304 | <p>Returns |
| 305 | -----= |
| 306 | <code>ImmichPerson</code></p></div> |
| 307 | </dd> |
| 308 | <dt id="aioimmich.people.ImmichPeople.async_get_person_thumbnail"><code class="name flex"> |
| 309 | <span>async def <span class="ident">async_get_person_thumbnail</span></span>(<span>self, person_id: str) ‑> bytes</span> |
| 310 | </code></dt> |
| 311 | <dd> |
| 312 | <details class="source"> |
| 313 | <summary> |
| 314 | <span>Expand source code</span> |
| 315 | </summary> |
| 316 | <pre><code class="python">async def async_get_person_thumbnail(self, person_id: str) -> bytes: |
| 317 | """Download thumbnail for a person. |
| 318 | |
| 319 | Args: |
| 320 | person_id (str): id of the person to fetch the thumbnail for |
| 321 | |
| 322 | Returns: |
| 323 | persons thumbnail as `bytes` |
| 324 | """ |
| 325 | result = await self.api.async_do_request( |
| 326 | f"people/{person_id}/thumbnail", application="octet-stream" |
| 327 | ) |
| 328 | assert isinstance(result, bytes) |
| 329 | return result</code></pre> |
| 330 | </details> |
| 331 | <div class="desc"><p>Download thumbnail for a person.</p> |
| 332 | <dl> |
| 333 | <dt>Args</dt> |
| 334 | <dt>-----=</dt> |
| 335 | <dt><strong><code>person_id</code></strong> : <code>str</code></dt> |
| 336 | <dd>id of the person to fetch the thumbnail for</dd> |
| 337 | </dl> |
| 338 | <p>Returns |
| 339 | -----= |
| 340 | persons thumbnail as <code>bytes</code></p></div> |
| 341 | </dd> |
| 342 | </dl> |
| 343 | </dd> |
| 344 | </dl> |
| 345 | </section> |
| 346 | </article> |
| 347 | <nav id="sidebar"> |
| 348 | <div class="toc"> |
| 349 | <ul></ul> |
| 350 | </div> |
| 351 | <ul id="index"> |
| 352 | <li><h3>Super-module</h3> |
| 353 | <ul> |
| 354 | <li><code><a title="aioimmich" href="../index.html">aioimmich</a></code></li> |
| 355 | </ul> |
| 356 | </li> |
| 357 | <li><h3><a href="#header-submodules">Sub-modules</a></h3> |
| 358 | <ul> |
| 359 | <li><code><a title="aioimmich.people.models" href="models.html">aioimmich.people.models</a></code></li> |
| 360 | </ul> |
| 361 | </li> |
| 362 | <li><h3><a href="#header-classes">Classes</a></h3> |
| 363 | <ul> |
| 364 | <li> |
| 365 | <h4><code><a title="aioimmich.people.ImmichPeople" href="#aioimmich.people.ImmichPeople">ImmichPeople</a></code></h4> |
| 366 | <ul class=""> |
| 367 | <li><code><a title="aioimmich.people.ImmichPeople.async_filter_people_by_name" href="#aioimmich.people.ImmichPeople.async_filter_people_by_name">async_filter_people_by_name</a></code></li> |
| 368 | <li><code><a title="aioimmich.people.ImmichPeople.async_get_all_people" href="#aioimmich.people.ImmichPeople.async_get_all_people">async_get_all_people</a></code></li> |
| 369 | <li><code><a title="aioimmich.people.ImmichPeople.async_get_people_count" href="#aioimmich.people.ImmichPeople.async_get_people_count">async_get_people_count</a></code></li> |
| 370 | <li><code><a title="aioimmich.people.ImmichPeople.async_get_person_by_id" href="#aioimmich.people.ImmichPeople.async_get_person_by_id">async_get_person_by_id</a></code></li> |
| 371 | <li><code><a title="aioimmich.people.ImmichPeople.async_get_person_thumbnail" href="#aioimmich.people.ImmichPeople.async_get_person_thumbnail">async_get_person_thumbnail</a></code></li> |
| 372 | </ul> |
| 373 | </li> |
| 374 | </ul> |
| 375 | </li> |
| 376 | </ul> |
| 377 | </nav> |
| 378 | </main> |
| 379 | <footer id="footer"> |
| 380 | <p>Generated by <a href="https://pdoc3.github.io/pdoc" title="pdoc: Python API documentation generator"><cite>pdoc</cite> 0.11.6</a>.</p> |
| 381 | </footer> |
| 382 | </body> |
| 383 | </html> |