Closed DustyTools closed 1 year ago
You're absolutely right, thx for the info. I've updated the section in the docs!
@ThomasPe - Great! Any chance you can let me know why it doesn't actual work? I get an error:
{StatusCode: 406, ReasonPhrase: 'Not Acceptable', Version: 1.1, Content: System.Net.Http.StreamContent, Headers: { Date: Fri, 25 Dec 2020 00:46:27 GMT Server: Apache Content-Length: 226 Content-Type: text/html; charset=iso-8859-1 }}
Hard to say, this is what the Integration Test looks like and it's working fine for me:
var media = await _clientAuth.Media.GetAll();
var file = media.FirstOrDefault();
Assert.IsNotNull(file);
var random = new Random();
var title = $"New Title {random.Next(0, 1000)}";
Assert.AreNotEqual(title, file.Title.Raw);
file.Title.Raw = title;
var desc = $"This is a nice cat! {random.Next(0, 1000)}";
file.Description.Raw = desc;
var fileUpdated = await _clientAuth.Media.Update(file);
Assert.IsNotNull(fileUpdated);
Assert.AreEqual(fileUpdated.Title.Raw, title);
Assert.AreEqual(fileUpdated.Description.Raw, desc);
The Media.Update() example is:
// returns updated media var media= client.Media.GetByID(123); page.Content.Raw = "New Content";
if (await client.IsValidJWToken()) { var updatedPage = await client.Media.Update(page); }
shouldn't this be:
// returns updated media var media= client.Media.GetByID(123); media.Title.Raw = "New Title";
if (await client.IsValidJWToken()) { var updatedMedia = await client.Media.Update(media); }