Skip to main content
Version: Current

SmartBuddies.GetSmartBuddyByIdAsync

Description​

Gets SmartBuddyInfo with specified Buddy Id from the connected AI Command Center.

Signature [C#]​

Task<SmartBuddyInfo> GetSmartBuddyByIdAsync(int buddyId);

Properties​

Input​

ParameterTypeRequired / defaultDescription
buddyIdintRequiredSpecify the buddy Id for which the Smart Buddy information has to be retrieved.

Output​

TypeDescription
Task<SmartBuddyInfo>Returns the information of a Smart Buddy using its Id.

Remarks​

Use GetSmartBuddyByIdAsync API to get SmartBuddyInfo details with specified buddy Id from the connected AI Command Center.

Example​

C#
public async Task GetSmartBuddyById()
{
IControlRoomContext context = LoginControlRoom();
try
{
int buddyId = 1;
SmartBuddyInfo smartBuddyInfo = await context.SmartBuddies.GetSmartBuddyByIdAsync(buddyId);
System.Console.WriteLine("SmartBuddy Name: " + smartBuddyInfo.Name);
}
finally
{
context.Close();
}
}
Connection helper
public IControlRoomContext LoginControlRoom()
{
string RequiredSetting(string name) => Environment.GetEnvironmentVariable(name) ?? throw new InvalidOperationException($"Set {name} before running this example.");
string serverUrl = RequiredSetting("INTELLIBUDDIES_SERVER_URL");
string userName = RequiredSetting("INTELLIBUDDIES_USERNAME");
string password = RequiredSetting("INTELLIBUDDIES_PASSWORD");
string connectionString = $"ServerUrl={serverUrl};UserName={userName};Password={password}";
IControlRoomContext context = new ControlRoomContext(connectionString);
context.Open();
return context;
}

See Get started for namespaces, configuration, and context cleanup, and SDK usage for error handling.