syntax = "proto3";

import "common.proto";

package apps_opener;


// ==== appsOpener capability ====

message AppVersions {
	string id = 1;
	common.StringValue current = 2;
	common.StringValue bundled = 3;
	repeated string packs = 4;
}

// --- appsOpener.listApps ---
message ListAppsRequestBody {
	repeated string filter = 1;
}
message ListAppsReplyBody {
	repeated AppVersions apps = 1;
}

// --- apps.Opener.getAppVersions ---
// Reply body is either empty or AppVersions
message GetAppVersionsRequestBody {
	string id = 1;
	repeated string filter = 2;
}

// --- apps.Opener.getAppManifest ---
// Reply body is either empty or common.StringValue with json string
message GetAppManifestRequestBody {
	string id = 1;
	common.StringValue version = 2;
}

// --- apps.Opener.getAppFileBytes ---
// Reply body is either empty or common.BytesValue
message GetAppFileBytesRequestBody {
	string id = 1;
	string path = 2;
	common.StringValue version = 3;
}

// --- apps.Opener.openApp ---
// Reply body is empty
message OpenAppRequestBody {
	string id = 1;
	bool devtools = 2;
}

// --- apps.Opener.watchApps ---
// Its an observable call, and initial request is empty.
// Observer expects AppEvent in next.

message AppEvent {
	string type = 1;
	string id = 2;
	string version = 3;
}
