adds move to album api
This commit is contained in:
parent
95facd4019
commit
381fc9a436
@ -66,6 +66,18 @@ public class AlbumApiTests : ApiTestsBase
|
||||
CorrectParamShouldGetSent("category_id", "1");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task Move_should_reassign_album()
|
||||
{
|
||||
SetOkResult();
|
||||
await _albumApi.MoveAsync(1, 2, "apiToken");
|
||||
|
||||
CorrectMethodShouldGetCalled("pwg.categories.move");
|
||||
CorrectParamShouldGetSent("category_id", "1");
|
||||
CorrectParamShouldGetSent("parent", "2");
|
||||
CorrectParamShouldGetSent("pwg_token", "apiToken");
|
||||
}
|
||||
|
||||
[Test]
|
||||
public async Task CalculateOrphansAsync_should_return_correct_values()
|
||||
{
|
||||
|
@ -85,6 +85,12 @@ public class AlbumApi : IAlbumApi
|
||||
return response.Result.Id.Value;
|
||||
}
|
||||
|
||||
public async Task MoveAsync(int albumId, int parentAlbumId, string apiToken, CancellationToken cancellationToken = default)
|
||||
{
|
||||
var formParams = new Dictionary<string, string> { { "category_id", albumId.ToString() }, { "parent", parentAlbumId.ToString() }, { "pwg_token", apiToken } };
|
||||
await _context.PostAsync<PiwigoResponse>(_logger, "pwg.categories.move", formParams, cancellationToken);
|
||||
}
|
||||
|
||||
public async Task<IReadOnlyCollection<Album>> GetAllAsync(CancellationToken cancellationToken = default)
|
||||
{
|
||||
var formParams = new Dictionary<string, string> { { "recursive", "true" } };
|
||||
|
@ -7,6 +7,7 @@ public interface IAlbumApi
|
||||
Task<AlbumOrphans> CalculateOrphansAsync(int albumId, CancellationToken cancellationToken = default);
|
||||
|
||||
Task DeleteAsync(int albumId, string apiToken, CancellationToken cancellationToken = default);
|
||||
Task MoveAsync(int albumId, int parentAlbumId, string apiToken, CancellationToken cancellationToken = default);
|
||||
|
||||
Task DeleteRepresentativeAsync(int albumId, CancellationToken cancellationToken = default);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user