unkai-0.1.0.1: CHANGELOG.md
# Changelog
## Unreleased
## 0.1.0.1 — 2026-11-24
- Ship the runtime on Hackage with a matching Cloud Storage client and core package.
## 0.1.0.0 — 2026-11-24
- Forked from gogol 1.0.0.0 (mori://brendanhay/gogol, upstream commit 881cd14c9844131b4a8d96ca1bbb2bd9a2409ed9) and renamed the `Gogol` namespace to `Unkai`.
- Require GHC 9.12 or newer; use the GHC2024 language edition.
- Use `gcloud auth application-default login` and `newEnv` for local sign-in. This replaces `Unkai.Auth.InstalledApplication`, `FromClient`, and the out-of-band redirect helpers. Explicit credentials can still be passed to `newEnvWith`. An unreadable or invalid file selected by `GOOGLE_APPLICATION_CREDENTIALS` now fails discovery with its path.
- Match `Left (AuthenticationError cause)` from `sendEither`, `uploadEither`, and `downloadEither` to handle credential problems. Keep a returned download `Stream` inside the `runResourceT` scope that opened it. Read failures after a successful download response occur when you consume the body.
- Import request functions, `Error`, `PatchField`, `Stream`, and `sinkLBS` from `Unkai`. The generator-facing `Unkai.Prelude` and `Unkai.Types` are available from `unkai-core`.
- **Breaking change.** `Stream` is now a Streamly stream of strict `ByteString` chunks. Add `streamly-core` and replace Conduit consumers with Streamly folds. Run the request and fold in the same `runResourceT` scope. `sinkLBS` still collects the entire body when you need it in memory.
```haskell
{-# LANGUAGE OverloadedStrings #-}
import Control.Monad.IO.Class (liftIO)
import Data.ByteString qualified as BS
import Streamly.Data.Fold qualified as Fold
import Streamly.Data.Stream qualified as Stream
import System.IO (IOMode (WriteMode), withBinaryFile)
import Unkai (Env, download, runResourceT)
import Unkai.Storage qualified as Storage
downloadFile :: Env '[Storage.Devstorage'ReadOnly] -> FilePath -> IO ()
downloadFile env output = withBinaryFile output WriteMode $ \handle ->
runResourceT $ do
stream <- download env (Storage.newStorageObjectsGet "bucket" "reports/q1.csv")
Stream.fold (Fold.drainMapM (liftIO . BS.hPut handle)) stream
```
- Pass raw names such as `reports/q1.csv` to generated constructors. They now encode the name as one path segment. Use `upload` for multipart uploads. It supplies `uploadType=multipart`.
- Use `newStorageObjectsMove bucket sourceObject destinationObject`, `newStorageObjectsCopy sourceBucket sourceObject destinationBucket destinationObject payload`, and the same source-first order for rewrite and folder rename. Named construction can make the role of each `Text` argument explicit.
```haskell
{-# LANGUAGE OverloadedStrings #-}
import Unkai.Storage qualified as Storage
move =
Storage.StorageObjectsMove
{ bucket = "b",
sourceObject = "reports/q1.csv",
destinationObject = "archive/q1.csv",
ifGenerationMatch = Nothing,
ifGenerationNotMatch = Nothing,
ifMetagenerationMatch = Nothing,
ifMetagenerationNotMatch = Nothing,
ifSourceGenerationMatch = Nothing,
ifSourceGenerationNotMatch = Nothing,
ifSourceMetagenerationMatch = Nothing,
ifSourceMetagenerationNotMatch = Nothing,
projection = Nothing,
userProject = Nothing
}
copy =
Storage.StorageObjectsCopy
{ sourceBucket = "b",
sourceObject = "reports/q1.csv",
destinationBucket = "archive",
destinationObject = "q1.csv",
payload = Storage.newObject,
destinationKmsKeyName = Nothing,
destinationPredefinedAcl = Nothing,
ifGenerationMatch = Nothing,
ifGenerationNotMatch = Nothing,
ifMetagenerationMatch = Nothing,
ifMetagenerationNotMatch = Nothing,
ifSourceGenerationMatch = Nothing,
ifSourceGenerationNotMatch = Nothing,
ifSourceMetagenerationMatch = Nothing,
ifSourceMetagenerationNotMatch = Nothing,
projection = Nothing,
sourceGeneration = Nothing,
userProject = Nothing
}
```
- Build PATCH bodies with constructors such as `newObjectPatch`. Set a field to `Set value` to assign it or `Clear` to send JSON null. `newObjectPatch` starts with all fields set to `Omit`. Use `newObject_MetadataPatch` with a map entry set to `Nothing` to clear one custom metadata key.
- Use `newBucketInsertInput name` for bucket creation. For compose, use `newComposeRequestInput` with a `NonEmpty` list of values built by `newComposeRequest_SourceObjectsItemInput name`. For an IAM policy replacement, `newPolicySetIamPolicyInput []` sends an empty bindings list.