MCPcopy Create free account
hub / github.com/Selectively11/CloudRedirect / CmdListRemoteAppIds

Function CmdListRemoteAppIds

src/common/cli.cpp:238–277  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

236}
237
238std::string CmdListRemoteAppIds(const std::string& provider, const std::string& accountId) {
239 std::string tokenPath = GetTokenPath(provider);
240 if (tokenPath.empty()) {
241 return JsonError("Cannot determine config directory");
242 }
243
244 auto prov = CreateCloudProvider(provider);
245 if (!prov) {
246 return JsonError("Unknown provider: " + provider);
247 }
248
249 if (!prov->Init(tokenPath)) {
250 return JsonError("Failed to initialize provider");
251 }
252
253 if (!prov->IsAuthenticated()) {
254 prov->Shutdown();
255 return JsonError("Not authenticated");
256 }
257
258 std::string prefix = accountId + "/";
259 auto folders = prov->ListSubfolders(prefix);
260 prov->Shutdown();
261
262 // Build JSON array of app IDs
263 std::ostringstream ids;
264 ids << "[";
265 bool first = true;
266 for (const auto& name : folders) {
267 if (!first) ids << ",";
268 ids << JsonString(name);
269 first = false;
270 }
271 ids << "]";
272
273 return JsonObject({
274 {"success", JsonBool(true)},
275 {"app_ids", ids.str()}
276 });
277}
278
279std::string CmdListRemoteAppFiles(const std::string& provider, const std::string& accountId, const std::string& appId) {
280 std::string tokenPath = GetTokenPath(provider);

Callers 1

RunCliFunction · 0.85

Calls 10

GetTokenPathFunction · 0.85
JsonErrorFunction · 0.85
CreateCloudProviderFunction · 0.85
JsonStringFunction · 0.85
JsonObjectFunction · 0.85
JsonBoolFunction · 0.85
InitMethod · 0.45
IsAuthenticatedMethod · 0.45
ShutdownMethod · 0.45
ListSubfoldersMethod · 0.45

Tested by

no test coverage detected