Skip to content

Commit 7ddc39a

Browse files
authored
Merge pull request #61 from CallFire/develop
CF-20351 Added findMedia API operation to sdk
2 parents 1e67437 + b0610ec commit 7ddc39a

File tree

14 files changed

+81
-10
lines changed

14 files changed

+81
-10
lines changed

CallfireApiClient.nuspec

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
<?xml version="1.0" encoding="UTF-8"?><package>
22
<metadata>
33
<id>CallfireApiClient</id>
4-
<version>1.1.22</version>
4+
<version>1.1.23</version>
55
<title>CallFire API v2 client</title>
66
<authors>
77
Vladimir Mikhailov
@@ -15,6 +15,9 @@
1515
<description>C# client library for integration with Callfire REST API v2 services</description>
1616
<releaseNotes>Callfire API client Changelog
1717
=============================
18+
Version 1.1.23 - Sept 26 2018
19+
- added findMedia API operation to sdk
20+
1821
Version 1.1.22 - Sept 04 2018
1922
- updated version of RestSharp client to 106.3.0
2023
- downgraded version of .NET framework to 4.6
@@ -117,7 +120,7 @@ Version 1.0.0 - Dec 29 2015
117120
<tags>Callfire rest api client</tags>
118121
<dependencies>
119122
<dependency id="Newtonsoft.Json" version="10.0.2"/>
120-
<dependency id="RestSharp" version="106.3.0"/>
123+
<dependency id="RestSharp" version="106.4.2"/>
121124
</dependencies>
122125
</metadata>
123126
<files>

Changelog.txt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
Callfire API client Changelog
22
=============================
3+
Version 1.1.23 - Sept 26 2018
4+
- added findMedia API operation to sdk
5+
36
Version 1.1.22 - Sept 04 2018
47
- updated version of RestSharp client to 106.3.0
58
- downgraded version of .NET framework to 4.6

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ C# client for Callfire platform API version 2. See link:https://developers.callf
88
99
.*Dependencies:*
1010
* Newtonsoft.Json >= 7.0.1
11-
* RestSharp >= 106.3.0
11+
* RestSharp >= 106.4.2
1212
1313
.*Table of contents*
1414
* link:https://developers.callfire.com/callfire-api-client-csharp.html[Getting Started]

src/CallfireApiClient.IntegrationTests/Api/CallsTexts/MediaApiIntegrationTest.cs

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using CallfireApiClient.Api.Common.Model;
44
using NUnit.Framework;
55
using System.IO;
6+
using CallfireApiClient.Api.CallsTexts.Model.Request;
67

78
namespace CallfireApiClient.IntegrationTests.Api.CallsTexts
89
{
@@ -11,6 +12,27 @@ public class MediaApiIntegrationTest : AbstractIntegrationTest
1112
{
1213
private const string mp3FilePath = "Resources/File-examples/train1.mp3";
1314
private const string wavFilePath = "Resources/File-examples/train1.wav";
15+
private const string cfLogoFilePath = "Resources/File-examples/cf.png";
16+
private const string ezLogoFilePath = "Resources/File-examples/ez.png";
17+
18+
[Test]
19+
public void TestFind()
20+
{
21+
ResourceId cfLogoResourceId = Client.MediaApi.Upload(cfLogoFilePath);
22+
ResourceId ezLogoResourceId = Client.MediaApi.Upload(ezLogoFilePath);
23+
Assert.NotNull(cfLogoResourceId.Id);
24+
Assert.NotNull(ezLogoResourceId.Id);
25+
26+
var request = new FindMediaRequest
27+
{
28+
Filter = "cf.png"
29+
};
30+
31+
Page<Media> media = Client.MediaApi.Find(request);
32+
33+
Console.WriteLine(media);
34+
Assert.AreEqual(1, media.Items.Count);
35+
}
1436

1537
[Test]
1638
public void TestUpload()

src/CallfireApiClient.IntegrationTests/CallfireApiClient.IntegrationTests.csproj

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,12 @@
8585
<EmbeddedResource Include="Resources\File-examples\train1.wav">
8686
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
8787
</EmbeddedResource>
88+
<EmbeddedResource Include="Resources\File-examples\cf.png">
89+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
90+
</EmbeddedResource>
91+
<EmbeddedResource Include="Resources\File-examples\ez.png">
92+
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
93+
</EmbeddedResource>
8894
</ItemGroup>
8995
<ItemGroup>
9096
<Content Include="callfire-api-client.dll.config">
1.44 KB
Loading
1.24 KB
Loading

src/CallfireApiClient.Tests/CallfireApiClient.Tests.csproj

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,9 @@
3535
<Reference Include="DotNetZip, Version=1.10.1.0, Culture=neutral, PublicKeyToken=6583c7c814667745">
3636
<HintPath>..\..\packages\DotNetZip.1.10.1\lib\net20\DotNetZip.dll</HintPath>
3737
</Reference>
38-
<Reference Include="RestSharp, Version=106.3.0.0, Culture=neutral, PublicKeyToken=598062e77f915f75">
39-
<HintPath>..\..\packages\RestSharp.106.3.0\lib\net452\RestSharp.dll</HintPath>
38+
<Reference Include="RestSharp, Version=106.4.2.0, Culture=neutral, PublicKeyToken=598062e77f915f75">
39+
<HintPath>..\..\packages\RestSharp.106.4.2\lib\net452\RestSharp.dll</HintPath>
40+
<Private>True</Private>
4041
</Reference>
4142
<Reference Include="System" />
4243
<Reference Include="System.Configuration" />
@@ -45,6 +46,7 @@
4546
</Reference>
4647
<Reference Include="Microsoft.Build.Utilities.v4.0" />
4748
<Reference Include="Microsoft.Build.Framework" />
49+
<Reference Include="System.Web" />
4850
<Reference Include="System.Xml" />
4951
</ItemGroup>
5052
<ItemGroup>

src/CallfireApiClient.Tests/packages.config

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,5 @@
33
<package id="DotNetZip" version="1.10.1" targetFramework="net46" />
44
<package id="NUnit" version="2.6.4" targetFramework="net46" />
55
<package id="NUnit.Runners.Net4" version="2.6.4" targetFramework="net46" />
6-
<package id="RestSharp" version="106.3.0" targetFramework="net46" />
6+
<package id="RestSharp" version="106.4.2" targetFramework="net46" />
77
</packages>

src/CallfireApiClient/Api/CallsTexts/MediaApi.cs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using CallfireApiClient.Api.Common.Model;
22
using CallfireApiClient.Api.CallsTexts.Model;
33
using System.IO;
4+
using CallfireApiClient.Api.CallsTexts.Model.Request;
45

56
namespace CallfireApiClient.Api.CallsTexts
67
{
@@ -18,6 +19,23 @@ internal MediaApi(RestApiClient client)
1819
{
1920
Client = client;
2021
}
22+
23+
/// <summary>
24+
/// Finds all media files which was uploaded by the user, filtered by file name.
25+
/// </summary>
26+
/// <param name="request">request object with different fields to filter</param>
27+
/// <returns>paged list with media objects</returns>
28+
/// <exception cref="BadRequestException"> in case HTTP response code is 400 - Bad request, the request was formatted improperly.</exception>
29+
/// <exception cref="UnauthorizedException"> in case HTTP response code is 401 - Unauthorized, API Key missing or invalid.</exception>
30+
/// <exception cref="AccessForbiddenException"> in case HTTP response code is 403 - Forbidden, insufficient permissions.</exception>
31+
/// <exception cref="ResourceNotFoundException"> in case HTTP response code is 404 - NOT FOUND, the resource requested does not exist.</exception>
32+
/// <exception cref="InternalServerErrorException"> in case HTTP response code is 500 - Internal Server Error.</exception>
33+
/// <exception cref="CallfireApiException"> in case HTTP response code is something different from codes listed above.</exception>
34+
/// <exception cref="CallfireClientException"> in case error has occurred in client.</exception>
35+
public Page<Media> Find(FindMediaRequest request)
36+
{
37+
return Client.Get<Page<Media>>(MEDIA_PATH, request);
38+
}
2139

2240
/// <summary>
2341
/// Upload media file to account

0 commit comments

Comments
 (0)