#nullable enable
using System;
-using System.Collections.Generic;
-using System.IO;
-using System.Linq;
-using System.Text;
using System.Threading.Tasks;
using OpenTween.Connection;
using OpenTween.Models;
public async Task Send(IApiConnection apiConnection)
{
- var json = this.CreateRequestBody();
- var responseText = await apiConnection.PostJsonAsync(EndpointUri, json);
- ErrorResponse.ThrowIfError(responseText);
+ var request = new PostJsonRequest
+ {
+ RequestUri = EndpointUri,
+ JsonString = this.CreateRequestBody(),
+ };
+
+ using var response = await apiConnection.SendAsync(request)
+ .ConfigureAwait(false);
+
+ var rootElm = await response.ReadAsJsonXml()
+ .ConfigureAwait(false);
+
+ ErrorResponse.ThrowIfError(rootElm);
}
}
}