/// <summary> /// Sends a message to the specific channel. /// </summary> /// <param name="channel">ID of the channel</param> /// <param name="message">Message</param> /// <returns>Async task</returns> public async Task <object> SendMessageAsync(Guid channel, NewMessage message) { // Creates addables List <IReqAddable> addables = LoginCookies.Select(x => (IReqAddable) new GuildedCookie(x.Name, x.Value)).ToList(); addables.Add(new JsonBody(JsonConvert.SerializeObject(message, Converters))); // Execute it return(await ExecuteRequest <object>(new Endpoint($"channels/{channel}/messages", Method.POST), addables.ToArray())); }
/// <summary> /// Changes the name of the user. /// </summary> /// <param name="name">New name</param> /// <returns>Async task</returns> public async Task ChangeNameAsync(string name) { // Creates addables List <IReqAddable> addables = LoginCookies.Select(x => (IReqAddable) new GuildedCookie(x.Name, x.Value)).ToList(); addables.Add(new JsonBody($"{{\"name\": \"{name}\"}}")); // Executes it await ExecuteRequest <object>(new Endpoint($"/users/{CurrentUser.Id}/profilev2", Method.POST), addables.ToArray()); }