SmartBuddies.GetSmartBuddyByNameAsync
Description
Gets the SmartBuddyInfo with the specified Smart Buddy name from the connected AI Command Center.
Signature [C#]
Task<SmartBuddyInfo> GetSmartBuddyByNameAsync(string buddyName);
Properties
Input
| Parameter | Type | Required / default | Description |
|---|---|---|---|
buddyName | string | Required | Specify the buddy name for which the Smart Buddy information has to be retrieved. |
Output
| Type | Description |
|---|---|
| Task<SmartBuddyInfo> | Returns the information of a smart buddy by using its Id. |
Remarks
Use GetSmartBuddyByNameAsync API to get the SmartBuddyInfo details with specified Smart Buddy name from the connected AI Command Center.
Example
C#
public async Task GetSmartBuddyByName()
{
IControlRoomContext context = LoginControlRoom();
try
{
string buddyName = "APITest_Buddy";
SmartBuddyInfo smartBuddy = await context.SmartBuddies.GetSmartBuddyByNameAsync(buddyName);
System.Console.WriteLine("SmartBuddy Name: " + smartBuddy.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.