Skip to content

V- Modal AI: Visual Video / Image Search - Flutter Video SDK

Release Flutter SDK from a462b76e2adf7275791a6ee9ee4a03dbb6519d00

vmodal-release-app2cca31e5e494
diff --git a/README.md b/README.md
index 858a158..13d59aa 100644
--- a/README.md
+++ b/README.md
@@ -65,11 +65,17 @@ final vmodal = VmodalClient(
## Search video with natural language
```dart
+final groups = await vmodal.collections.listGroups(mode: 'vid_file');
+if (groups.data.isEmpty) {
+ throw StateError('No video collection exists for this API key');
+}
+final collectionName = groups.data.first.groupName;
+
final results = await vmodal.searches.searchVideo(
- const SearchRequest(
+ SearchRequest(
queryText: 'the cyclist crossing the bridge at sunset',
- groupName: 'travel_diaries',
- searchSources: ['ocr', 'asr', 'image'],
+ groupName: collectionName,
+ searchSources: const ['image'],
limit: 20,
),
);
@@ -80,6 +86,13 @@ for (final moment in results.data) {
}
```
+`collectionName` must be the `groupName` of a `vid_file` collection returned
+for the current runtime API key. Collection access is key-scoped; a name copied
+from another account or environment can return HTTP 404 even when the search
+route is healthy. The example name `flutter_example` is valid only after that
+key has uploaded or otherwise created the collection and a refreshed
+`listGroups()` response contains it.
+
The response stays typed where the contract is stable and preserves the raw JSON so new server fields remain available immediately.
## Upload with progress and cancellation
diff --git a/RELEASE_METADATA b/RELEASE_METADATA
index 5149bb0..bf2abcb 100644
--- a/RELEASE_METADATA
+++ b/RELEASE_METADATA
@@ -1 +1 @@
-Source-vmx-api: 5136d84a8a03e066a099f1b0c4c455deb4e2c1b7
+Source-vmx-api: a462b76e2adf7275791a6ee9ee4a03dbb6519d00
diff --git a/SOURCE_MANIFEST.sha256 b/SOURCE_MANIFEST.sha256
index be4591b..ddf3ad4 100644
--- a/SOURCE_MANIFEST.sha256
+++ b/SOURCE_MANIFEST.sha256
@@ -1,7 +1,4 @@
002abcc5d95c0cf20375adefe4ee2472581a615e64f5726bf361dd5c679cdea7 test/auth_http_test.dart
-008655dc4707449090b05556247f12e3f210bae227e1dc62b1e28c40a2c3c537 test/resources_models_test.dart
-00abc247751b8e899e28bf2a33c003ebebba8a5241689c10f4d321d1f1a20540 RELEASE_METADATA
-031d62a7749209b887086adceff8ce666bf81e5f9bda2775fb4d650f901d08c1 example/test/widget_test.dart
05a8215a0f8d4d5ca26d8dfdf93d8c41b5785d84855459f979b079527f6232b3 lib/src/api_key_provider.dart
09a850ca6ebd5470138b7f20204d4dbe0fec89d268a205f14cf3bff0b99f365b build.sh
0a1394c90829b91541aa01e9786e3195aae04fc49a7b92775dbf404bf2802107 test/fakes_test.dart
@@ -9,7 +6,6 @@
11b247bc6796892d67c9a821d18604db4dd6a880981b34f38460b9866e6b247f example/ios/Runner.xcworkspace/xcshareddata/WorkspaceSettings.xcsettings
13bacc486006b6b6ae11ae37b2cda0dddf588b8aa8e72c1b13e570b95f36aa59 doc/sdk_contract.md
14368b598ece0ce9b2e249148a10a92f2c80e38427c077013a1515826f4365bd test/fixtures/routes_contract.json
-1886337e99c5c47473d3f14df9941d7c932321d789c6f6a5af412e6a384ad009 example/README.md
19be171481dc71a0b2803ebcd01dd8b0c5fd5778dee34c0a3cabc948c225f24e example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
19be171481dc71a0b2803ebcd01dd8b0c5fd5778dee34c0a3cabc948c225f24e example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
1a8d11d01d1cc92c650c9c9ed35299240052d4683a15a719a2315ef44185e074 example/ios/Runner/Runner-Bridging-Header.h
@@ -23,12 +19,11 @@
2eaee2d6e00f6085ad65d7ff63a20963e78b635cb3d41eb15be4f37f55430295 example/asset/video_10frames.mp4
30b0832ed8b92dfbd6ae2abfa939ccf26333d37600056b1572bd4a397a18a74b example/android/app/src/debug/AndroidManifest.xml
30b0832ed8b92dfbd6ae2abfa939ccf26333d37600056b1572bd4a397a18a74b example/android/app/src/profile/AndroidManifest.xml
-3156038fbb15ba2048a87f190b14744c13e4b858f1247b373f419090432ac7a2 lib/src/utils.dart
318ca9f582d3a74cbee346857d2df1b50a2deeb7fb687ab64eeeddd037157b3e example/ios/Runner/Info.plist
3221993eac1057198d652b7437105e2953ca4850d415eb0eb2b9625874fd059e example/android/gradle/wrapper/gradle-wrapper.properties
+3270adb09a27fb379747524a7d94f5958818a85067d0df0c634c7b401866d7d5 test/regression_manifest_test.dart
+337b610dab998481876a5efcfd008b1037420494104ce12572f2b344637913a0 test/resources_models_test.dart
37b7148216ac6090e36adfb699d642b8dd1e1b8ba99870e65e88733947a59fa6 LICENSE
-37e41b32944b2969165f891409dff50a491f154a2be091a842b27f7da79bea2b example/lib/main.dart
-39a60e405c807abeec1a44ecc3aaee029d91ea4643bef463ed8293d8e0e5eb87 test/workflow_layout_test.dart
3b1e214f466ffedff74baa5598ad5c4421130eea6bc8d57b8fe23435e8280ae4 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/Contents.json
3c34e1f298d0c9ea3455d46db6b7759c8211a49e9ec6e44b635fc5c87dfb4180 example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
406de1350b79662fcaf007cb0cacd7a6b71b83815dc7cd3c7b561fcfba5600a3 tool/check_route_sync.dart
@@ -41,14 +36,15 @@
47ce679eef585b28fe5e10a92a642eef4946c5d33d56411202734139b1db8e7b example/android/app/src/main/kotlin/com/vmodal/sdk/vmodal_example/MainActivity.kt
4d470bf22d5c17d84edc5f82516d1ba8a1c09559cd761cefb792f86d9f52b540 example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png
5c90a4437c33000865ee889e1e2afb875d3e1abc83e5d3150e867efe1240232c doc/sdk_doc.md
-5d6f8ff6f9e38deb47587b6df7bc765732d3dd4efb3677bb02e47c032ddb7c13 doc/release.md
5d7e5bdf01b93802bc973345b3a78c038907147625035952a08a115a563b7f81 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
5dee24dc104ac76dc162e42ae0beb163d426bf365562ee28ba7b3ad368559a60 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
5e8f4908dacea6f29b2a790e4d38bf5fded69096063f9a27a2f21584d62b30c0 example/ios/RunnerTests/RunnerTests.swift
5ee841b9f4a4e4bb682aac32c401b600bc972006ce158869496605d1df8fda60 security_check.sh
6a26dba2cb8dfba1e74f540b0d17a89d96c1301d3c3bfda14348bed257fddcba example/android/build.gradle.kts
6a7c8f0d703e3682108f9662f813302236240d3f8f638bb391e32bfb96055fef example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png
+6e785c7885b880da65d2b8aea7948b6713b198f79b152ef6efb03e3aacdb1d6a README.md
72fff91181fd3e25fd9afd766930a67025205b61096fd35c55cbdd9a3178ecf0 pubspec.lock
+732e7f2f942e1c427e19ee3bdb766053f625f69e87dcf770d969555dbc7a9881 lib/src/utils.dart
744ea1477f794e3a2f8f4b8f7e63fe5a84da6f027f5bf83c9780f81bce0fb09d lib/src/config.dart
7770183009e914112de7d8ef1d235a6a30c5834424858e0d2f8253f6b8d31926 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
79e3de3c03451cd9d62327430106edf861da6aeb97b546bbac2d93a0bcbbe3d3 test/transport_test.dart
@@ -59,6 +55,7 @@
807e56bf3e3fb8a082d8b802658ce8735bef5b88998ccd6f46f010955aa0081a example/android/app/build.gradle.kts
836c918cb613249eba0483a6b02fa3df3c1c0a89a315ee4d3b88509b83c7ab73 example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
857e61203b3deafb05766d8fcda898b86a7cb6f3d5e385ecc9926c4d698215e9 example/ios/Runner/Base.lproj/LaunchScreen.storyboard
+8996015c73f1ba4a323d298dd5b558b642725422971aa66947132a2f790250e0 doc/release.md
8b6a10c89a44568aed939d712b05b120f513e04e909ba141a4d55998afa9aaa5 lib/src/resources.dart
8c5bad5152f217e837519f9c15211d19f39bd45f5f67faf6dd81cb4b299e518f example/android/app/src/main/res/values-night/styles.xml
937d7c82f539c72eb94fd3a3773f29b3d3fef1997213c92cb632298cedf4bda9 example/android/app/src/main/res/values/styles.xml
@@ -66,17 +63,19 @@
93ae7d494fad0fb30cbf3ae746a39c4bc7a0f8bbf87fbb587a3f3c01f3c5ce20 example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected]
93ae7d494fad0fb30cbf3ae746a39c4bc7a0f8bbf87fbb587a3f3c01f3c5ce20 example/ios/Runner/Assets.xcassets/LaunchImage.imageset/[email protected]
94433756fe10005ddd6fc55cc5c0b1e9f3c10b66a08ceac795ece6713d34e28a example/android/app/src/main/res/drawable/launch_background.xml
-970aad998c7e3d34430ff59c72aa224e60155f85038efa7ffc6fdf73b531437a test/regression_manifest_test.dart
+9e1238f41046a713e0b3157a53a0be86bd74f548187e83920cde3b8e67f24f67 lib/src/models.dart
9fbce429f56243561dd437a527136c9f9ed77165e3b271b923faf236cfcd0484 example/ios/Runner.xcodeproj/xcshareddata/xcschemes/Runner.xcscheme
+a0175c6ed42796d783d99ef5889d05811b5dba10c7f50e697ecab0fed24c9945 example/lib/main.dart
a3134f6fc8387589e96a345ea35d4c68240c7c1893ef5cd5926707e4168e5309 lib/src/transport.dart
a80b38547f5d9ca1874f60e71c648e3fc12ab5f7cb88d1bead6d5b863d3c0245 readme_assets/dev_homepage.jpg
a82d7765b37116ee4821d2cd1d65942febf8032353757ffb0826eabde785b4a6 example/ios/Flutter/Debug.xcconfig
a82d7765b37116ee4821d2cd1d65942febf8032353757ffb0826eabde785b4a6 example/ios/Flutter/Release.xcconfig
+a8b39ed66acd738fd81dbcba1788a35715df695505ee58969c8a89742d9ab17b example/test/widget_test.dart
a985b626c4f7546a8ba392d135e9226c3547c8e2b46895f5f2bdf40d7b14ef9f example/ios/Runner/Assets.xcassets/LaunchImage.imageset/README.md
a9b21eb6f4271385655a8771f76e29eef8c1107d7879cbcfc567e6619d1f716a example/ios/Runner/Assets.xcassets/AppIcon.appiconset/[email protected]
add68b905971dedfcc0d0b5b7118030de5925ba8c081ad9815463699e3a444ad example/ios/Runner/SceneDelegate.swift
+aec2fbebf9de7b9f21ca75c5433eae6c514c632883040727acec0d2c5fa19c41 RELEASE_METADATA
af86f6d0d7c5f10f0df759b04790d0b0f495446916ce121b3ef68e4d86d4fd8a lib/src/client.dart
-b17d54b5038c909311e45c811b288e3506e3c6b7d4bc29d3e65c56e357178c1f README.md
b1d3b70a6c9ecde707a9f139a3e7c5a2b4db808e9746db6ac6195c2205c9522e test/fakes.dart
b2dc1cfc58dcd93d62c8f4a1c05210c9f4a3e5b93e69541a40fcf8176cb5f2aa .pubignore
b8013ee0b123493f6277937c99ea4432063162a4167d99d5356647738261b7c1 example/android/app/src/main/AndroidManifest.xml
@@ -96,16 +95,17 @@ cafa2529768e48a6b89f85a069e337eff7a5cf75103d6ac8623bdbb7a1088549 lib/src/collec
ccc7950fd5f5b82067c85f667940a9d59189151460761ece8098ca78daa19469 example/ios/Runner/Assets.xcassets/LaunchImage.imageset/Contents.json
cf9402a50d0b10a4a1002fa7aeef3b98c0f12e7638dd8cb3acd26d286bd66914 tool/release_manifest.dart
cfff9cdf89ea54b00de5fc13eba57e8aeef785a0a53b892c77be41772531ae7f example/android/gradle.properties
-d09f68c36895c2550a6b78d378b0ca1d533b16ae12ead55f3d6dbcfb9997996f lib/src/models.dart
d2411f67f427c095c7d82718c23ddd114fa39221e43333bfd55ac8ece9e4c877 lib/src/upload.dart
d31d6bb36542a9022c62d2d9940b0efd07f60b1cdfb30e35f8be8b15a226c843 run.sh
d5f5f9246656a5c275c5ab5863dbf3945d8ef6b1c9042c9d1912cfafce93646f tool/flutter_checksums.txt
+d759a8d836e088b95502481b7e8dab09556834b83d471c33476890de2e7ebb4e test/workflow_layout_test.dart
da12038f9b2688a8a26160fea2609fa8fcb11421448c109f09c0f573efe7698d example/ios/Flutter/AppFrameworkInfo.plist
da330cad4fc27776d249a5db97c1e20bf2cac015d0bbab73b781c0a9ec15b00f doc/search_app.md
dd2a40eaedcf0f194d5faf7abf398124506f9db206d418617a69b7361d6ec349 lib/vmodal_sdk_flutter.dart
def7e4f643adff5b01b877b6a7fa5b2381612b693c0bf06bd232ee0f7197d342 analysis_options.yaml
dfa0f9bb85b95ccba9c6811adadf8cb407fb5d52088e89db83ebc308ec448542 example/ios/Runner.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
dfa0f9bb85b95ccba9c6811adadf8cb407fb5d52088e89db83ebc308ec448542 example/ios/Runner.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist
+e0451fd568c97a89b6562fe4dfc66b2fed9f610d8fa4e6a0512b2e0c8e29cf28 example/README.md
e0ea485cfdbc3e12b93efb8679a5ea73ebfe20ea4ca0c473dc594fc2fb274ed5 example/analysis_options.yaml
e14aa40904929bf313fded22cf7e7ffcbf1d1aac4263b5ef1be8bfce650397aa example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png
e246ed229511a24a1ee7e98529c203ef90d1d352290ce8486caebe05683db3a0 env.sh
diff --git a/doc/release.md b/doc/release.md
index 235ef74..4539fe7 100644
--- a/doc/release.md
+++ b/doc/release.md
@@ -15,6 +15,15 @@ pub.dev publication. Optional pub.dev publication is triggered only by the
exported version tag and uses OIDC trusted publishing; no long-lived pub token is
stored.
+After the tested SDK source is published, the same workflow regenerates
+`docs_swagger`, validates its OpenAPI contract, and publishes the immutable site
+artifact to the `gh-pages` branch of the existing public repository
+`v-modal/vmodal_sdk_flutter`. The workflow configures GitHub Pages and verifies
+the exact source SHA at `https://v-modal.github.io/vmodal_sdk_flutter/`. The
+deployment depends on both the source publication and the workflow's
+secret-detection gate, so documentation cannot publish from an untested SDK
+candidate.
+
Multipart is excluded from production live claims until all five backend routes
are verified. A failed publication is fixed forward with a new version after the
entire candidate pipeline passes again.
diff --git a/example/README.md b/example/README.md
index 6d6c14c..d2d82d6 100644
--- a/example/README.md
+++ b/example/README.md
@@ -3,16 +3,34 @@
This application shows a complete VModal SDK evaluation workflow on Android or
iOS:
-1. Create a client with a runtime API key.
-2. Confirm which user is authenticated.
-3. Choose a video or use the bundled 10-frame sample.
-4. Upload it while displaying progress and cancellation.
-5. Create an image index and refresh its job state.
+1. Authenticate with a runtime API key and stop if identity resolution fails.
+2. List the collections visible to the authenticated user.
+3. List the existing index jobs for the selected collection.
+4. Reuse ready data, or upload the bundled 10-frame sample or another video.
+5. Create an image index when needed and wait until it is ready.
6. Search the indexed collection and inspect result fields.
-The example is intentionally simple. It keeps all UI and SDK calls in
-[`lib/main.dart`](lib/main.dart), so a beginner can follow the complete flow in
-one file.
+The runnable example is intentionally simple. It keeps its UI and SDK calls in
+[`lib/main.dart`](lib/main.dart), so a beginner can follow the main flow in one
+file. This guide also shows `jobsList()`, which an application can use to load
+index jobs created during earlier runs.
+
+## Beginner validation flow
+
+After the app opens, validate one stage at a time:
+
+```text
+authentication
+ -> existing collections
+ -> existing index jobs
+ -> existing ready data OR upload
+ -> index ready
+ -> search
+```
+
+Do not continue after a failed stage. An empty collection or index-job list is
+not a failure; it means this account needs an upload or a new index before it
+can search.
## What you need
@@ -143,39 +161,101 @@ Keep this terminal open while developing:
- Press `R` for a full hot restart.
- Press `q` to stop the app.
-## 6. Configure the VModal client
+## 6. First validation: authenticate
When the application opens:
1. Paste a valid runtime API key into **Runtime API key**.
2. Tap **Configure client**.
-3. Check the status message at the bottom of the screen.
+3. Confirm that the status says:
-The expected status is:
+ ```text
+ Client configured. Resolve identity to load its collections.
+ ```
-```text
-Client configured. Resolve identity or search next.
+4. Tap **Resolve auth.me**.
+5. Do not continue until the app displays `Authenticated user type: ...`.
+
+The authentication request is:
+
+```dart
+final me = await client.auth.me();
```
The input is obscured, and the example clears the text field after creating
the client. The key remains only in `MutableApiKeyProvider` memory while the
application is running.
-## 7. Confirm authentication
+If authentication fails, stop here. Check that the key is valid, has not
+expired, and belongs to the intended VModal environment. Upload, indexing, and
+search are not useful checks until `auth.me()` succeeds.
-Tap **Resolve auth.me**.
+## 7. List existing collections
-The example calls:
+A successful **Resolve auth.me** request automatically loads the existing
+`vid_file` collections visible to that runtime API key. You can also tap
+**Refresh collections** to run the collection check again:
```dart
-final me = await client.auth.me();
+final groups = await client.collections.listGroups(mode: 'vid_file');
+```
+
+Validate the result before continuing:
+
+- `Loaded N video collection(s).` means collection access works. Select one of
+ the names shown under **Available collections**.
+- `No existing video collections...` is a valid empty-account result. Keep the
+ suggested `flutter_example` name and continue to upload.
+- An SDK error means this stage failed. Do not continue until authentication,
+ environment selection, or collection access is fixed.
+
+If the current Collection value is not in the returned list, the example
+selects the first available collection. Refresh the list whenever uploads or
+another client may have changed it.
+
+The Collection field must contain a collection returned for the current API
+key before search. Access is key-scoped: a name from another account or
+environment returns HTTP 404 even when the route is healthy. `flutter_example`
+is only a suggested name for a new upload; do not search it until refreshing
+the list shows that it exists and its index is ready.
+
+## 8. List existing index jobs
+
+For an existing collection, check its index jobs before uploading or creating
+another index:
+
+```dart
+const collectionName = 'your_collection_from_step_7';
+final jobs = await client.indexes.jobsList(
+ mode: 'vid_file',
+ groupName: collectionName,
+);
+
+print('Index jobs: ${jobs.total}');
+for (final job in jobs.data) {
+ print(job);
+}
```
-A successful request displays the authenticated user type. If you receive an
-SDK error instead, check that the key is valid, has not expired, and belongs to
-the intended VModal environment.
+The API exposes index jobs rather than a separate index catalog. Each job
+records an indexing attempt and its state. Treat the result as follows:
+
+- A completed state such as `success`, `completed`, `done`, or `ok` means the
+ collection is a candidate for immediate search.
+- A queued or running state means wait and check that job with
+ `client.indexes.indexStatus(jobId)`.
+- An empty list means no index job exists for that collection. Upload data if
+ needed, then create an index.
+- A failed state means inspect the job error and fix it before search.
+
+The example screen displays the job created during the current run. Use
+`jobsList()` in your application when you also need to show jobs from earlier
+runs. If the account has no collections, skip this check and upload first.
+
+## 9. Choose and upload a video when needed
-## 8. Choose and upload a video
+If Step 8 found a completed index job and you want to search that existing
+collection, skip to Step 11. Otherwise, upload a video and create its index.
The repository includes
[`asset/video_10frames.mp4`](asset/video_10frames.mp4), a one-second, 320 × 240
@@ -198,7 +278,9 @@ To use the bundled sample:
6. Tap **Cancel** while an upload is running to test cancellation. The sample
is very small, so it may finish before you can cancel it.
-The upload is stored under:
+By default, the upload is stored under the Collection and Stream currently
+shown in the app. On an account with no collections, the suggested new target
+is:
```text
collection: flutter_example
@@ -226,7 +308,7 @@ The SDK streams the file instead of loading the complete video into memory.
`task.progress` reports upload progress, `task.result` completes with the
server response, and `task.cancel()` cancels the operation.
-## 9. Create and monitor the image index
+## 10. Create and monitor the image index
After upload succeeds:
@@ -254,7 +336,7 @@ Indexing is asynchronous. The create call returning successfully means the job
was accepted, not that search data is ready. Use the visible refresh action or
`client.indexes.indexStatus(job.jobId)` until it reaches a terminal state.
-## 10. Search and inspect results
+## 11. Search and inspect results
1. Leave the default query, `red`, for the bundled colored sample or enter a
visual description for your chosen video.
@@ -263,7 +345,8 @@ was accepted, not that search data is ready. Use the visible refresh action or
source modality, timestamp, and normalized score.
Search and upload use the same **Collection** and **Stream** fields. The example
-searches the image index created in the previous step:
+refreshes the authenticated key's collection list before every search and
+searches the ready image index selected or created in the earlier steps:
```dart
final result = await client.searches.searchVideo(
@@ -276,11 +359,13 @@ final result = await client.searches.searchVideo(
);
```
-A zero result count is still successful. If the collection has not been
-indexed, the server can return HTTP 404 even though the route is working; the
-example reports that condition without displaying internal server paths.
+A zero result count is still successful. Search is blocked locally when the
+Collection value is not returned for the current key. If the collection exists
+but has not been indexed, the server can return HTTP 404 even though the route
+is working; the example reports that condition without displaying internal
+server paths.
-## 11. Stop and clean up
+## 12. Stop and clean up
Press `q` in the terminal to stop `flutter run`.
diff --git a/example/lib/main.dart b/example/lib/main.dart
index 156f8de..7520a69 100644
--- a/example/lib/main.dart
+++ b/example/lib/main.dart
@@ -10,6 +10,17 @@ const String exampleCollectionName = 'flutter_example';
const String exampleStreamName = 'astream';
const String exampleIndexType = 'vid_img_emb';
+List<String> exampleCollectionNames(GroupsResponse response) {
+ final names = response.data
+ .where((GroupItem item) => item.mode == 'vid_file')
+ .map((GroupItem item) => item.groupName.trim())
+ .where((String name) => name.isNotEmpty)
+ .toSet()
+ .toList();
+ names.sort();
+ return names;
+}
+
SearchRequest exampleSearchRequest(
String query,
String collectionName,
@@ -112,6 +123,8 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
int _progress = 0;
bool _busy = false;
bool _hasSearched = false;
+ bool _collectionsLoaded = false;
+ List<String> _collections = <String>[];
@override
void initState() {
@@ -147,7 +160,9 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
_client = client;
_safeState(() {
_key.clear();
- _status = 'Client configured. Resolve identity or search next.';
+ _collectionsLoaded = false;
+ _collections = <String>[];
+ _status = 'Client configured. Resolve identity to load its collections.';
});
}
@@ -156,7 +171,32 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
if (client == null) return _needClient();
await _run(() async {
final me = await client.auth.me();
- _safeState(() => _status = 'Authenticated user type: ${me.type}');
+ final groups = await client.collections.listGroups(mode: 'vid_file');
+ final names = exampleCollectionNames(groups);
+ _setCollections(
+ names,
+ names.isEmpty
+ ? 'Authenticated user type: ${me.type}. No existing video '
+ 'collections were found; upload to create one.'
+ : 'Authenticated user type: ${me.type}. Loaded '
+ '${names.length} video collection(s).',
+ selectFirst: true,
+ );
+ });
+ }
+
+ Future<void> _loadCollections() async {
+ final client = _client;
+ if (client == null) return _needClient();
+ await _run(() async {
+ final groups = await client.collections.listGroups(mode: 'vid_file');
+ final names = exampleCollectionNames(groups);
+ _setCollections(
+ names,
+ names.isEmpty
+ ? 'No existing video collections are available for this API key.'
+ : 'Loaded ${names.length} video collection(s).',
+ );
});
}
@@ -232,10 +272,24 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
Future<void> _search() async {
final client = _client;
if (client == null) return _needClient();
- final collection = _collection.text.trim();
- final stream = _stream.text.trim();
- if (collection.isEmpty || stream.isEmpty) return _needCollection();
await _run(() async {
+ final groups = await client.collections.listGroups(mode: 'vid_file');
+ final names = exampleCollectionNames(groups);
+ final collection = _collection.text.trim();
+ final stream = _stream.text.trim();
+ _setCollections(names, '', selectFirst: false);
+ if (collection.isEmpty || stream.isEmpty) {
+ _needCollection();
+ return;
+ }
+ if (!names.contains(collection)) {
+ _safeState(
+ () => _status =
+ 'Collection $collection is not available for this '
+ 'API key. Choose a loaded collection or upload it first.',
+ );
+ return;
+ }
try {
final result = await client.searches.searchVideo(
exampleSearchRequest(_query.text, collection, stream),
@@ -319,6 +373,29 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
_safeState(() => _status = 'Collection and stream are required.');
}
+ void _setCollections(
+ List<String> names,
+ String status, {
+ bool selectFirst = false,
+ }) {
+ final current = _collection.text.trim();
+ final selected = selectFirst && names.isNotEmpty && !names.contains(current)
+ ? names.first
+ : current;
+ _safeState(() {
+ _collections = names;
+ _collectionsLoaded = true;
+ if (selected != current) {
+ _collection.text = selected;
+ _jobId = '';
+ _indexStatus = 'not started';
+ _results = <Map<String, Object?>>[];
+ _hasSearched = false;
+ }
+ if (status.isNotEmpty) _status = status;
+ });
+ }
+
void _scopeChanged(String _) {
if (_jobId.isEmpty && _results.isEmpty) return;
_safeState(() {
@@ -374,11 +451,25 @@ class _VmodalExampleAppState extends State<VmodalExampleApp> {
onPressed: _busy ? null : _identity,
child: const Text('Resolve auth.me'),
),
+ OutlinedButton(
+ onPressed: _busy ? null : _loadCollections,
+ child: const Text('Refresh collections'),
+ ),
TextField(
controller: _collection,
onChanged: _scopeChanged,
- decoration: const InputDecoration(labelText: 'Collection'),
+ decoration: const InputDecoration(
+ labelText: 'Collection',
+ helperText: 'Must exist for the current API key before search.',
+ ),
),
+ if (_collectionsLoaded)
+ Text(
+ _collections.isEmpty
+ ? 'Available collections: none'
+ : 'Available collections: ${_collections.join(', ')}',
+ key: const Key('available-collections'),
+ ),
TextField(
controller: _stream,
onChanged: _scopeChanged,
diff --git a/example/test/widget_test.dart b/example/test/widget_test.dart
index 05c2b01..42e59a6 100644
--- a/example/test/widget_test.dart
+++ b/example/test/widget_test.dart
@@ -10,6 +10,7 @@ void main() {
await tester.pumpWidget(const VmodalExampleApp());
expect(find.widgetWithText(TextField, 'Runtime API key'), findsOneWidget);
expect(find.text('Configure client'), findsOneWidget);
+ expect(find.text('Refresh collections'), findsOneWidget);
expect(find.widgetWithText(TextField, 'Collection'), findsOneWidget);
expect(find.widgetWithText(TextField, 'Stream'), findsOneWidget);
await tester.drag(find.byType(ListView), const Offset(0, -600));
@@ -40,6 +41,20 @@ void main() {
expect(index.modality, exampleIndexType);
});
+ test('collection names come from the authenticated video groups', () {
+ final names = exampleCollectionNames(
+ GroupsResponse(<String, Object?>{
+ 'total': 3,
+ 'data': <Object?>[
+ <String, Object?>{'mode': 'vid_file', 'group_name': 'travel'},
+ <String, Object?>{'mode': 'img_file', 'group_name': 'images'},
+ <String, Object?>{'mode': 'vid_file', 'group_name': 'archive'},
+ ],
+ }),
+ );
+ expect(names, <String>['archive', 'travel']);
+ });
+
test('search 404 is explained without exposing the server body', () {
const path = '/private/server/path/table';
const error = ApiException(
diff --git a/lib/src/models.dart b/lib/src/models.dart
index 57bed31..28ef220 100644
--- a/lib/src/models.dart
+++ b/lib/src/models.dart
@@ -12,7 +12,22 @@ class SearchResultItem extends JsonBackedResponse {
}
class GroupItem extends JsonBackedResponse {
- const GroupItem(super.raw);
+ GroupItem(super.raw)
+ : userId = '${raw['user_id'] ?? ''}',
+ mode = '${raw['mode'] ?? ''}',
+ groupName = '${raw['group_name'] ?? ''}',
+ videoGroup = '${raw['video_group'] ?? ''}',
+ modalityTypes = stringList(raw['modality_types']),
+ lancedbVersions = stringList(raw['lancedb_versions']),
+ lastUpdated = raw['last_updated']?.toString();
+
+ final String userId;
+ final String mode;
+ final String groupName;
+ final String videoGroup;
+ final List<String> modalityTypes;
+ final List<String> lancedbVersions;
+ final String? lastUpdated;
}
class FolderUploadItem extends JsonBackedResponse {
@@ -326,13 +341,11 @@ class SearchResponse extends JsonBackedResponse {
class GroupsResponse extends JsonBackedResponse {
GroupsResponse(super.raw)
- : data = raw['data'] is List
- ? List<Object?>.from(raw['data']! as List)
- : <Object?>[],
+ : data = objectList(raw['data']).map(GroupItem.new).toList(),
total = intValue(raw['total']),
executionTimeMs = doubleValue(raw['execution_time_ms']);
- final List<Object?> data;
+ final List<GroupItem> data;
final int total;
final double executionTimeMs;
}
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index 5d32c1f..74f2935 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -68,6 +68,11 @@ List<Map<String, Object?>> objectList(Object? value) {
.toList(growable: false);
}
+List<String> stringList(Object? value) {
+ if (value is! List) return <String>[];
+ return value.map((Object? item) => '$item').toList(growable: false);
+}
+
Object? jsonDecodeStrict(List<int> bytes) {
try {
final text = utf8.decode(bytes);
diff --git a/test/regression_manifest_test.dart b/test/regression_manifest_test.dart
index d5a5061..dec2ede 100644
--- a/test/regression_manifest_test.dart
+++ b/test/regression_manifest_test.dart
@@ -99,6 +99,14 @@ void main() {
]);
expect(result.exitCode, 0, reason: '${result.stderr}');
expect(File('${dir.path}/pubspec.lock').existsSync(), isTrue);
+ for (final path in <String>[
+ 'install.sh',
+ 'build.sh',
+ 'run.sh',
+ 'test.sh',
+ ]) {
+ expect(File('${dir.path}/$path').existsSync(), isTrue, reason: path);
+ }
for (final path in <String>[
'example/android/local.properties',
'example/android/gradle/wrapper/gradle-wrapper.jar',
diff --git a/test/resources_models_test.dart b/test/resources_models_test.dart
index fc5058e..cf9260d 100644
--- a/test/resources_models_test.dart
+++ b/test/resources_models_test.dart
@@ -43,6 +43,22 @@ void main() {
expect(response.cntActual, 2);
expect(response.cntTotal, 3);
expect(response.executionTimeMs, 1.5);
+
+ final groups = GroupsResponse(<String, Object?>{
+ 'total': 1,
+ 'data': <Object?>[
+ <String, Object?>{
+ 'user_id': 'u',
+ 'mode': 'vid_file',
+ 'group_name': 'travel',
+ 'video_group': 'vid_file-travel',
+ 'modality_types': <String>['vid_img_emb'],
+ 'lancedb_versions': <String>['v2'],
+ },
+ ],
+ });
+ expect(groups.data.single.groupName, 'travel');
+ expect(groups.data.single.lancedbVersions, <String>['v2']);
});
test('gateway bulk image payload removes nested identity fields', () async {
diff --git a/test/workflow_layout_test.dart b/test/workflow_layout_test.dart
index 2b1c55e..fcbbb9a 100644
--- a/test/workflow_layout_test.dart
+++ b/test/workflow_layout_test.dart
@@ -60,9 +60,41 @@ void checkWorkflow(String main, String tagged) {
expect(main, isNot(contains('--log-opts=')));
expect(main, contains('SHA256SUMS'));
expect(main, contains('SOURCE_MANIFEST.sha256'));
+ expect(main, contains('for file in install.sh build.sh run.sh test.sh; do'));
+ expect(main, contains('test -f "\$export_dir/\$file"'));
+ expect(main, contains('git ls-files --error-unmatch "\$file"'));
expect(main, contains('RELEASE_TOKEN: \${{ secrets.GH_TOKEN }}'));
expect(main, isNot(contains('FLUTTER_SDK_APP_')));
expect(main, contains('git push --atomic'));
+ expect(
+ main,
+ contains(
+ 'swagger_docs_artifact:\n needs: [secret_detection, publish_sdk_flutter]\n $releaseOnly',
+ ),
+ );
+ expect(
+ main,
+ contains(
+ 'publish_swagger_docs:\n needs: swagger_docs_artifact\n $releaseOnly',
+ ),
+ );
+ expect(main, contains('python "\$WORKDIR/docs.py" generate'));
+ expect(main, contains('python "\$WORKDIR/docs.py" check'));
+ expect(
+ main,
+ contains('openapi-spec-validator "\$WORKDIR/docs_swagger/swagger.yaml"'),
+ );
+ expect(main, contains('path: \${{ env.WORKDIR }}/docs_swagger'));
+ expect(main, contains('include-hidden-files: true'));
+ expect(main, contains('DOCS_REPOSITORY: v-modal/vmodal_sdk_flutter'));
+ expect(
+ main,
+ contains('DOCS_URL: https://v-modal.github.io/vmodal_sdk_flutter'),
+ );
+ expect(main, isNot(contains('gh repo create "\$DOCS_REPOSITORY"')));
+ expect(main, contains('git push origin HEAD:gh-pages'));
+ expect(main, contains('repos/\$DOCS_REPOSITORY/pages'));
+ expect(main, contains('"\$DOCS_URL/RELEASE_SHA"'));
expect(main, contains('for attempt in {1..30}'));
expect(main, contains('https://pub.dev/api/packages/vmodal_sdk_flutter'));