[FEATURE REQUEST] Rename Clients
JaronrH opened this issue · 1 comments
JaronrH commented
I needed the ability to rename clients so I added the following to your API:
/// <summary>
/// Rename Client
/// </summary>
/// <param name="client">Client to rename</param>
/// <param name="name">New Name</param>
public async Task<Responses.ResponseEnvelope<Responses.Clients>> RenameClient(Responses.Clients client, string name)
{
return await RenameClient(client.Id, name);
}
/// <summary>
/// Rename Client
/// </summary>
/// <param name="userId">Client's User Id for client to be renamed.</param>
/// <param name="name">New Name</param>
public async Task<Responses.ResponseEnvelope<Responses.Clients>> RenameClient(string userId, string name)
{
// Make the POST request towards the UniFi API to rename a client.
var resultString = await HttpUtility.PostRequest(new Uri(BaseUri, $"/api/s/{SiteId}/upd/user/{userId}"),
JsonConvert.SerializeObject(new {name}),
_cookieContainer,
ConnectionTimeout);
var resultJson = JsonConvert.DeserializeObject<Responses.ResponseEnvelope<Responses.Clients>>(resultString);
return resultJson;
}
KoenZomers commented
Thanks for the suggestion! Just released a new version in which this has been included.
https://www.nuget.org/packages/KoenZomers.UniFi.Api/1.1.8