OmnyStoreClient class
The client SDK: an OmnyStoreApi backed by a remote OmnyStore server.
Web-compatible. Nothing here imports dart:io; the only transport is
package:http, so the same code runs on the Dart VM, in Flutter, and
compiled to JavaScript in a browser.
final client = OmnyStoreClient(baseUrl: 'https://store.example.com');
final latest = await client.latestRelease('omnyagent');
final update = await client.checkForUpdates(
packageReference: 'omnyagent',
currentVersion: Version.parse('1.0.0'),
channel: ReleaseChannel.beta,
platform: 'macos-arm64',
);
if (update.isInstallable) {
final bytes = await client.downloadAsset(update.asset!.id);
}
Errors keep their type across the network. The server sends a code with
every failure and this client rebuilds the original exception from it, so
on ReleaseNotFoundException and on ChecksumMismatchException work
exactly as they do against an embedded store. That is what lets code written
against OmnyStoreApi move between embedded and remote with no changes.
Uploads. attachAsset streams on the VM. In a browser the underlying HTTP client cannot stream a request body, so the artifact is buffered first — fine for the sizes a browser uploads, and the reason CI publishing should run on the VM.
- Implemented types
Constructors
- OmnyStoreClient({required Object baseUrl, AuthProvider auth = const AnonymousAuthProvider(), Duration timeout = const Duration(seconds: 30), String? userAgent, Client? httpClient})
-
Creates a client for the server at
baseUrl.
Properties
- apiPath → String
-
The base path every versioned endpoint hangs off.
no setter
- auth → AuthProvider
-
Supplies credentials for each request.
final
- baseUrl → Uri
-
The server's base URL (
https://store.example.com), without the/api/v1suffix.final - hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- timeout → Duration
-
How long to wait for a response before giving up.
final
- userAgent → String
-
The
user-agentsent with every request.final
Methods
-
asset(
String id) → Future< Asset?> -
The asset with
id, ornull.override -
assetByName(
String releaseId, String name) → Future< Asset?> -
The asset named
namewithinreleaseId, ornull.override -
assetDownloadUrl(
String assetId) → Uri - The URL an artifact is fetched from.
-
attachAsset(
{required String releaseId, required String name, required Stream< List< data, int? length, String contentType = 'application/octet-stream', String? expectedSha256, String? platform, String? kind, Map<int> >String, String> metadata = const {}}) → Future<Asset> -
Attaches an asset named
nametoreleaseId, streamingdatainto storage.override -
checkForUpdates(
{required String packageReference, required Version currentVersion, ReleaseChannel? channel, String? platform}) → Future< UpdateInfo> -
Answers "is there a newer version of
packageReferencethancurrentVersion, onchannel, forplatform?".override -
close(
) → Future< void> -
Releases any resources held (HTTP clients, storage handles).
override
-
createOrganization(
{required String name, String? displayName, String? description, String? website, Map< String, String> metadata = const {}}) → Future<Organization> -
Creates an organization named
name.override -
createPackage(
{required String projectId, required String name, String? displayName, String? description, ReleaseChannel defaultChannel = ReleaseChannel.release, List< String> platforms = const [], Map<String, String> metadata = const {}}) → Future<Package> -
Creates a package named
nameunderprojectId.override -
createProject(
{required String organizationId, required String name, String? displayName, String? description, String? repository, String? website, Map< String, String> metadata = const {}}) → Future<Project> -
Creates a project named
nameunderorganizationId.override -
deleteAsset(
String id) → Future< void> -
Deletes the asset with
idand its stored bytes on every provider.override -
deleteOrganization(
String id, {bool force = false}) → Future< void> -
Deletes the organization with
idand everything under it.override -
deletePackage(
String id, {bool force = false}) → Future< void> -
Deletes the package with
id.forceis required if it has releases.override -
deleteProject(
String id, {bool force = false}) → Future< void> -
Deletes the project with
id.forceis required if it has packages.override -
deleteRelease(
String id) → Future< void> -
Deletes the release with
id, its assets and their stored bytes.override -
downloadAsset(
String id, {ByteRange? range}) → Future< Uint8List> -
Downloads the asset with
idinto memory and verifies its checksum. -
downloadStats(
String packageReference, {DateTime? from, DateTime? to}) → Future< DownloadStats> -
Aggregated download statistics for
packageReference.override -
downloadTarget(
String id, {Duration expiresIn = const Duration(minutes: 15)}) → Future< DownloadTarget> -
Where a client should fetch the asset with
idfrom.override -
health(
) → Future< Map< String, dynamic> > - The server's health document.
-
latestAny(
String packageReference) → Future< Release?> -
The newest offerable release of
packageReferenceon any channel.override -
latestBeta(
String packageReference) → Future< Release?> -
The newest offerable beta release of
packageReference, ornull.override -
latestChannel(
String packageReference, ReleaseChannel channel, {bool exact = false}) → Future< Release?> -
The newest release of
packageReferencea client onchannelwould accept, ornull.override -
latestDev(
String packageReference) → Future< Release?> -
The newest offerable dev release of
packageReference, ornull.override -
latestRelease(
String packageReference) → Future< Release?> -
The newest offerable stable release of
packageReference, ornull.override -
listAssets(
String releaseId) → Future< List< Asset> > -
Assets of
releaseId, ordered by name.override -
listDownloads(
String packageReference, {int? limit, DateTime? from, DateTime? to}) → Future< List< DownloadRecord> > -
Download records for
packageReference, newest first.override -
listOrganizations(
) → Future< List< Organization> > -
Every organization, ordered by name.
override
-
listPackages(
{String? projectId, String? organizationId}) → Future< List< Package> > -
Packages of
projectIdororganizationId, or every package when both arenull.override -
listProjects(
{String? organizationId}) → Future< List< Project> > -
Projects of
organizationId, or every project when it isnull.override -
listProviders(
{String? organization}) → Future< List< ProviderDescriptor> > -
The storage providers this store knows about.
override
-
listReleases(
String packageReference, {ReleaseQuery query = const ReleaseQuery()}) → Future< List< Release> > -
Releases of
packageReferencematchingquery, newest first.override -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
openAsset(
String id, {ByteRange? range}) → Future< AssetDownload> -
Opens the bytes of the asset with
id, optionally restricted torange.override -
organization(
String id) → Future< Organization?> -
The organization with
id, ornull.override -
organizationByName(
String name) → Future< Organization?> -
The organization named
name, ornull.override -
package(
String id) → Future< Package?> -
The package with
id, ornull.override -
packageByName(
String projectId, String name) → Future< Package?> -
The package named
namewithinprojectId, ornull.override -
project(
String id) → Future< Project?> -
The project with
id, ornull.override -
projectByName(
String organizationId, String name) → Future< Project?> -
The project named
namewithinorganizationId, ornull.override -
promoteRelease(
String releaseId, ReleaseChannel channel, {String? notes}) → Future< Release> -
Promotes
releaseIdtochannelby publishing its artifacts under a new version carrying that channel's tag.override -
publishRelease(
{required String packageReference, required Version version, String? title, String? notes, String? tag, bool draft = false, Map< String, String> metadata = const {}}) → Future<Release> -
Publishes
versionof the packagepackageReferenceresolves to.override -
recordDownload(
{required String assetId, String? clientAddress, String? userAgent, String? principalId, String? providerId, int? bytesServed}) → Future< DownloadRecord> -
Records that the asset with
assetIdwas downloaded, and increments its counter.override -
release(
String id) → Future< Release?> -
The release with
id, ornull.override -
releaseByVersion(
String packageReference, Version version) → Future< Release?> -
The release of
packageReferenceatversion, ornull.override -
resolvePackage(
String reference) → Future< Package> -
Resolves a package from an id or a bare name.
override
-
toString(
) → String -
A string representation of this object.
inherited
-
updateOrganization(
String id, {String? displayName, String? description, String? website, Map< String, String> ? metadata}) → Future<Organization> -
Updates the mutable fields of the organization with
id.override -
updatePackage(
String id, {String? displayName, String? description, ReleaseChannel? defaultChannel, List< String> ? platforms, Map<String, String> ? metadata}) → Future<Package> -
Updates the mutable fields of the package with
id.override -
updateProject(
String id, {String? displayName, String? description, String? repository, String? website, Map< String, String> ? metadata}) → Future<Project> -
Updates the mutable fields of the project with
id.override -
updateRelease(
String id, {String? title, String? notes, String? tag, bool? draft, bool? yanked, String? yankedReason, Map< String, String> ? metadata}) → Future<Release> -
Updates a release's mutable metadata: notes, title, draft state, and
yanking.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited