private async Task <TransferSearchResult> FindTransferByIdentifierAsync(string transferIdentifier) { var searchRequest = new TransferSearchRequest() { SearchString = transferIdentifier }; return(await _client.Transfer.SearchAsync(searchRequest)); }
public async Task ShouldSearch() { /// Arrange var request = new TransferSearchRequest { Limit = 1, SearchString = "*" }; /// Act TransferSearchResult result = await _client.Transfers.SearchAsync(request); /// Assert Assert.NotNull(result); Assert.Equal(1, result.Results.Count); }
public static async Task <string> GetRandomTransferIdAsync(PictureparkClient client, TransferState?transferState, int limit) { var transferId = string.Empty; var request = new TransferSearchRequest { Limit = limit }; if (transferState.HasValue) { request.Filter = new ChildFilter { ChildType = "TransferInfo", Filter = new TermFilter { Field = "state", Term = transferState.ToString() } }; } var result = await client.Transfers.SearchAsync(request); var transfers = result.Results; if (transfers.Count <= 0) { return(transferId); } var randomNumber = new Random().Next(0, transfers.Count); transferId = transfers.Skip(randomNumber).First().Id; return(transferId); }