-
Notifications
You must be signed in to change notification settings - Fork 69
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8aa16fa
commit 3bc06eb
Showing
13 changed files
with
363 additions
and
130 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
using NUnit.Framework; | ||
using SystemHttp = System.Net.Http; | ||
|
||
namespace CloudinaryDotNet.Tests.SearchApi | ||
{ | ||
public class SearchFoldersTest | ||
{ | ||
private MockedCloudinary _cloudinary = new MockedCloudinary(); | ||
|
||
[SetUp] | ||
public void SetUp() | ||
{ | ||
_cloudinary = new MockedCloudinary(); | ||
} | ||
|
||
[Test] | ||
public void TestShouldSearchFolders() | ||
{ | ||
_cloudinary | ||
.SearchFolders() | ||
.Expression("path:*") | ||
.MaxResults(1) | ||
.Execute(); | ||
|
||
_cloudinary.AssertHttpCall(SystemHttp.HttpMethod.Post, "folders/search"); | ||
|
||
var requestJson = _cloudinary.RequestJson(); | ||
|
||
Assert.IsNotNull(requestJson["expression"]); | ||
Assert.AreEqual("path:*", requestJson["expression"].ToString()); | ||
Assert.IsNotNull(requestJson["max_results"]); | ||
Assert.AreEqual("1", requestJson["max_results"].ToString()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
namespace CloudinaryDotNet.Actions | ||
{ | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// The details of the folder found. | ||
/// </summary> | ||
[DataContract] | ||
public class SearchFolder | ||
{ | ||
/// <summary> | ||
/// Gets or sets the name of the folder. | ||
/// </summary> | ||
[DataMember(Name = "name")] | ||
public string Name; | ||
|
||
/// <summary> | ||
/// Gets or sets the path of the folder. | ||
/// </summary> | ||
[DataMember(Name = "path")] | ||
public string Path { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets date when the folder was created. | ||
/// </summary> | ||
[DataMember(Name = "created_at")] | ||
public string CreatedAt { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the eternal id of the folder. | ||
/// </summary> | ||
[DataMember(Name = "external_id")] | ||
public string ExternalId { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace CloudinaryDotNet.Actions | ||
{ | ||
using System.Collections.Generic; | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// Search response with information about the folders matching the search criteria. | ||
/// </summary> | ||
[DataContract] | ||
public class SearchFoldersResult : SearchResultBase | ||
{ | ||
/// <summary> | ||
/// Gets or sets the details of each of the folders found. | ||
/// </summary> | ||
[DataMember(Name = "folders")] | ||
public List<SearchFolder> Folders { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
namespace CloudinaryDotNet.Actions | ||
{ | ||
using System.Runtime.Serialization; | ||
|
||
/// <summary> | ||
/// Search response with information matching the search criteria. | ||
/// </summary> | ||
public class SearchResultBase : BaseResult | ||
{ | ||
/// <summary> | ||
/// Gets or sets the total count of assets matching the search criteria. | ||
/// </summary> | ||
[DataMember(Name = "total_count")] | ||
public int TotalCount { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets the time taken to process the request. | ||
/// </summary> | ||
[DataMember(Name = "time")] | ||
public long Time { get; set; } | ||
|
||
/// <summary> | ||
/// Gets or sets when a search request has more results to return than max_results, the next_cursor value is returned as | ||
/// part of the response. | ||
/// </summary> | ||
[DataMember(Name = "next_cursor")] | ||
public string NextCursor { get; set; } | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
namespace CloudinaryDotNet | ||
{ | ||
/// <summary> | ||
/// Advanced search provider. Allows you to retrieve information on all the assets in your account with the help of | ||
/// query expressions in a Lucene-like query language. | ||
/// </summary> | ||
public class Search : SearchFluent<Search> | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="Search"/> class. | ||
/// </summary> | ||
/// <param name="api">Provider of the API calls.</param> | ||
public Search(ApiShared api) | ||
: base(api) | ||
{ | ||
} | ||
} | ||
} |
Oops, something went wrong.