using Piwigo.Client.Contract; namespace Piwigo.Client; public interface IImageApi { /// /// Adds an image to piwigo after all parts have been uploaded. /// /// The metadata of the uploaded image /// /// /// /// Information about the uploaded image /// Ensure that you called for every chunk of the image. Task AddAsync(ImageUpload imageUpload, CancellationToken cancellationToken = default); /// /// Updates an image to piwigo after all parts have been uploaded. /// /// The image id to update /// The metadata of the uploaded image /// /// /// /// Information about the uploaded image /// Ensure that you called for every chunk of the image. Task UpdateAsync(int imageId, ImageUpload imageUpload, CancellationToken cancellationToken = default); /// /// Adds a comment to the given image. /// /// The id of the image /// The author /// The content /// /// The key to post: The key can read from and /// /// /// /// /// The id of the new comment Task AddCommentAsync(int imageId, string? author, string content, string key, CancellationToken cancellationToken = default); /// /// Adds a chunk of an image to piwigo. /// This enables uploading of large images using multiple chunks of data. /// /// The chunk to upload /// The original image checksum /// The chunk position /// /// /// Task AddChunkAsync(byte[] data, string originalSum, int position, CancellationToken cancellationToken = default); /// /// Checks if piwigo is ready to get images uploaded. /// /// /// /// /// true if ready; otherwise false Task ReadyForUploadAsync(CancellationToken cancellationToken = default); /// /// Gets detailed information about the image. /// /// The image id to read /// The requested comments page /// Number of comments per page /// /// /// /// The metadata of a given image id Task GetInfoAsync(int imageId, int? commentsPage, int? commentsPerPage, CancellationToken cancellationToken = default); /// /// Gets a list of images for a given album. /// /// The album id /// true to get images from sub-albums /// Information about the paging /// Filter criteria applied to the returned images /// How the list should be sorted /// /// /// /// a paged list of the images of a given album Task GetImagesAsync(int albumId, bool recursive, ImagePagingInfo page, ImageFilter filter, ImageOrder order = ImageOrder.Name, CancellationToken cancellationToken = default); /// /// Checks if an image is the same as on the server. /// /// The image id /// The md5 checksum of the given image /// /// /// /// /// /// Task CheckImageAsync(int imageId, string md5Sum, CancellationToken cancellationToken = default); /// /// Deletes the given image from the server. /// /// the image id to delete /// The API token that can be read from /// /// /// /// true if the image was found and removed; false if it does not exist Task DeleteAsync(int imageId, string apiToken, CancellationToken cancellationToken = default); /// /// Deletes a block of orphaned images from the server and returns the number of remaining orphans. /// /// The API token that can be read from /// Number of orphaned images to delete in this call /// /// /// /// The number of deleted orphans and the number of remaining orphan images. Task DeleteOrphansAsync(string apiToken, int? blockSize = null, CancellationToken cancellationToken = default); /// /// Checks if the given images can be found by their md5 sum. /// This method will only return any information if the configuration of your server contains the following setting: /// $conf[uniqueness_mode]==md5sum /// /// A enumerable of md5sums to check against the piwigo instance /// /// /// /// /// A dictionary containing the md5sum as key and the image id as value. The image id is null if the image does /// not exist. /// Task> ExistsByMd5SumsAsync(IEnumerable md5Sums, CancellationToken cancellationToken = default); /// /// Rates an image. This function only works if you have image rating enabled on your instance under Admin -> /// Configuration -> Options -> General in section Permission. /// /// The image id that should get this rate /// Rating from 0 to 5 /// /// /// /// Your current rating and the average score including number of rates. Task RateAsync(int imageId, int rate, CancellationToken cancellationToken = default); /// /// Updates or replaces image information depending on the provided update modes. /// /// Image id to update /// The image information to use /// UpdateMode for single value fields: /// UpdateMode for multi value fields: /// /// /// /// Task SetInfoAsync(int imageId, ImageInfo imageInfo, ValueUpdateMode singleValueMode = ValueUpdateMode.Append, ValueUpdateMode multiValueMode = ValueUpdateMode.Append, CancellationToken cancellationToken = default); }