My agentic slop goes here. Not intended for anyone else!
at main 2.7 kB view raw
1(** Immiche - Immich API client library 2 3 This library provides a clean Eio-based interface to interact with Immich 4 instances for managing people and face recognition data. 5*) 6 7(** {1 Types} *) 8 9(** Type representing an Immich client with connection pooling *) 10type t 11 12(** Type representing a person in Immich *) 13type person = { 14 id: string; 15 name: string; 16 birth_date: string option; 17 thumbnail_path: string; 18 is_hidden: bool; 19 unknown: Jsont.json; (** Unknown/extra JSON fields preserved during parsing *) 20} 21 22(** Type for the people API response *) 23type people_response = { 24 total: int; 25 visible: int; 26 people: person list; 27 unknown: Jsont.json; (** Unknown/extra JSON fields preserved during parsing *) 28} 29 30(** {1 Client Creation} *) 31 32(** [create ~requests_session ~base_url ~api_key] creates a new Immich client. 33 34 @param requests_session Shared Requests session for connection pooling 35 @param base_url The base URL of the Immich instance (e.g., "https://photos.example.com") 36 @param api_key The API key for authentication 37 @return An Immich client configured for the specified instance 38*) 39val create : 40 requests_session:(float Eio.Time.clock_ty Eio.Resource.t, [`Generic | `Unix] Eio.Net.ty Eio.Resource.t) Requests.t -> 41 base_url:string -> 42 api_key:string -> 43 t 44 45(** {1 API Functions} *) 46 47(** [fetch_people client] fetches all people from an Immich instance. 48 49 @param client The Immich client 50 @return A people_response containing all people and metadata 51 @raise Failure if the API request fails 52*) 53val fetch_people : t -> people_response 54 55(** [fetch_person client ~person_id] fetches details for a single person. 56 57 @param client The Immich client 58 @param person_id The ID of the person to fetch 59 @return The person details 60 @raise Failure if the API request fails or person not found 61*) 62val fetch_person : t -> person_id:string -> person 63 64(** [download_thumbnail client ~fs ~person_id ~output_path] downloads 65 a person's thumbnail image to a file. 66 67 @param client The Immich client 68 @param fs The Eio filesystem capability 69 @param person_id The ID of the person whose thumbnail to download 70 @param output_path The file path where the thumbnail should be saved 71 @return Ok () on success, or Error with a message on failure 72*) 73val download_thumbnail : 74 t -> 75 fs:_ Eio.Path.t -> 76 person_id:string -> 77 output_path:string -> 78 (unit, [> `Msg of string]) result 79 80(** [search_person client ~name] searches for people by name. 81 82 @param client The Immich client 83 @param name The name to search for 84 @return A list of matching people 85 @raise Failure if the API request fails 86*) 87val search_person : t -> name:string -> person list