# UrlHashResult What the conditional `PackHasher.sha1FromUrl(url, policy, ifModifiedSince, ifNoneMatch)` overload returns. `notModified()` is true when the origin answered 304 and sent no body — the case that makes the automatic refresh cheap. Otherwise `sha1()` holds the hash, and `lastModified()` / `etag()` are the values to cache and replay on the next check. --- ## Source ```java package gg.lode.paintingapi.api.hash; import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; /** * Outcome of a conditional pack fetch. * * @param sha1 hex SHA-1 of the body, or null when the origin answered 304 * @param lastModified the response's {@code Last-Modified}, to replay on the next fetch * @param etag the response's {@code ETag}, to replay on the next fetch * @param bytes body length in bytes, -1 when nothing was downloaded */ public record UrlHashResult(@Nullable String sha1, @Nullable String lastModified, @Nullable String etag, long bytes) { public static final UrlHashResult NOT_MODIFIED = new UrlHashResult(null, null, null, -1L); /** True when the origin said the pack is unchanged and sent no body. */ public boolean notModified() { return sha1 == null; } public @NotNull String sha1OrThrow() { if (sha1 == null) throw new IllegalStateException("pack was not modified — no hash was computed"); return sha1; } } ``` --- ## Related Pages - [[Painting/API/Hash/PackHasher]] — returns this from the conditional overload - [[Painting/Server Owners/Configuration]] — `hash-refresh-throttle` paces the checks