Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions CurrentReleaseChanges.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
- defaultLiveMessage, defaultMachineMessage, defaultLiveMessageSoundId, defaultMachineMessageSoundId, defaultVoice params added to send calls api
- added batch id filter parameter for get broadcast calls/texts
- added fields filter parameter for add sound via call, returns CampaignSound object
- added fields filter parameter for add sound via text-to-speech, returns CampaignSound object
- defaultMessage parameter added to send texts function
- added findWebhookResource and findWebhookResources methods to use new webhooks apis
- resumeNextDay parameter added to CallBroadcast object
- transferMessage, transferMessageSoundId, transferDigit, transferNumber params added to CallRecipient object for sending calls and texts
- added questionResponses parameter to CallRecord object
- added duplicate parameter to CampaignSound object
- get call recordings api functions implemented in CallsApi
79 changes: 77 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
import org.gradle.internal.os.OperatingSystem
import org.apache.tools.ant.taskdefs.condition.Os
import org.gradle.api.tasks.AbstractExecTask
import groovy.xml.XmlUtil
import groovy.xml.StreamingMarkupBuilder

plugins {
id 'com.ullink.msbuild' version '2.14'
id 'com.ullink.nuget' version '2.12'
id 'com.ullink.nunit' version '1.4'
id 'com.ullink.opencover' version '1.2'
id 'net.researchgate.release' version '2.3.4'
id 'com.github.jlouns.cpe' version '0.4.1'
id "co.riiid.gradle" version "0.4.2"
}

archivesBaseName = 'callfire-api-client'
ext['buildReleaseConfiguration'] = "CallfireApiClient"
ext['buildReleaseConfiguration'] = "Release"
ext['buildDebugConfiguration'] = "Debug"
ext['assemblyBinReleaseDir'] = "src/CallfireApiClient/bin/$buildReleaseConfiguration"
Expand Down Expand Up @@ -84,7 +89,7 @@ task updateNuspecFile << {
updateNuspecFile.dependsOn msbuildDebug

def patchVersion(version) {
def regex = ~/\[assembly: AssemblyVersion\("(.*)\.\*"\)\]/
def regex = ~/\[assembly: AssemblyVersion\("(.*)\.\*"\)\]/
def matcher = regex.matcher(new File(assemblyInfo).text)
while(matcher.find()) {
def updated = matcher.group(1)
Expand All @@ -96,7 +101,7 @@ def patchVersion(version) {

task zipBinaries(type: Zip) {
destinationDir = file(buildDistDir)
baseName = "CallfireApiClient"
baseName = "CallfireApiClient"
from 'LICENSE.txt'
from 'Changelog.txt'
from (assemblyBinReleaseDir) {
Expand All @@ -117,6 +122,76 @@ nugetPack {
}
nugetPack.dependsOn zipBinaries

task prepareTestData () << {
def inFile = file('src/CallfireApiClient.IntegrationTests/App.config')
def xml = new XmlSlurper().parse(inFile)

def apiLogin
def apiPassword

try {
apiLogin = "${testApiUsername}"
apiPassword = "${testApiPassword}"
println([ msbuild.projects['CallfireApiClient.IntegrationTests'].properties.TargetPath ])
} catch(Exception ex) {
println("Api Username and/or Password are empty, you can't run integrationTests task, set them with -PtestApiUsername/-PtestApiPassword options")
apiLogin = "login"
apiPassword = "password"
}

if (apiLogin != 'null' && apiPassword != 'null') {
xml.appSettings.add.findAll { it.@key == 'testLogin' || it.@key == 'testPassword' }.each { it.replaceNode {} }
xml.appSettings.appendNode {
add(key: "testLogin", value: apiLogin) {}
add(key: "testPassword", value: apiPassword) {}
}
}
def fw = new FileWriter('src/CallfireApiClient.IntegrationTests/App.config')
XmlUtil.serialize(xml, fw)
// have to close manually because on windows file remains locked
fw.close()
}

task msbuildForIntegrationTests (type: com.ullink.Msbuild) {
solutionFile = 'callfire-api-client-csharp.sln'
configuration = buildReleaseConfiguration
projectName = 'CallfireApiClient'
}
msbuildForIntegrationTests.dependsOn prepareTestData

task integrationTests (type: com.ullink.gradle.nunit.NUnit) {
testAssemblies = [ msbuild.projects['CallfireApiClient.IntegrationTests'].properties.TargetPath ]
}
integrationTests.dependsOn msbuildForIntegrationTests

task prepareReleaseData () << {
try {
println("${gitHubOwner}")
println("${gitHubToken}")
} catch(Exception ex) {
println("GitHub Owner and/or Token are empty, you can't run github release task, set them with -PgitHubOwner/-PgitHubToken options")
}
}
prepareReleaseData.dependsOn nugetPack

task configureCustomGitHubRelease () << {
github {
owner = "${gitHubOwner}"
repo = 'callfire-api-client-csharp'
token = "${gitHubToken}"
tagName = project.version
targetCommitish = 'master'
name = project.version
body = file('CurrentReleaseChanges.txt').text
assets = [
'build/dist/CallfireApiClient-' + project.version + '.zip',
'build/dist/CallfireApiClient.' + project.version + '.nupkg'
]
}
}
configureCustomGitHubRelease.dependsOn prepareReleaseData
githubRelease.dependsOn configureCustomGitHubRelease

// nuget package upload, requires API key to be set
nugetPush {
apiKey = System.properties[ 'NUGET_API_KEY' ] ?: "key not set"
Expand Down
16 changes: 11 additions & 5 deletions callfire-api-client-csharp.sln
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CallfireApiClient", "src\Ca
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CallfireApiClient.Tests", "src\CallfireApiClient.Tests\CallfireApiClient.Tests.csproj", "{17AF49CB-38AF-484D-9151-B470F320221D}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CallfireApiClient.IntegrationTests", "src\CallfireApiClient.IntegrationTests\CallfireApiClient.IntegrationTests.csproj", "{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C}"
EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{88EF74FD-46C2-4510-A4C2-BCFACA8E3399}"
ProjectSection(SolutionItems) = preProject
build.gradle = build.gradle
Expand All @@ -24,22 +26,26 @@ Global
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Debug|Any CPU.Deploy.0 = Debug|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Release|Any CPU.Build.0 = Release|Any CPU
{17AF49CB-38AF-484D-9151-B470F320221D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{17AF49CB-38AF-484D-9151-B470F320221D}.Debug|Any CPU.Build.0 = Debug|Any CPU
{17AF49CB-38AF-484D-9151-B470F320221D}.Release|Any CPU.ActiveCfg = Release|Any CPU
{17AF49CB-38AF-484D-9151-B470F320221D}.Release|Any CPU.Build.0 = Release|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Debug|Any CPU.Build.0 = Debug|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Release|Any CPU.ActiveCfg = Release|Any CPU
{7C6961C8-3576-4499-92B6-3B5D798BDBFC}.Release|Any CPU.Build.0 = Release|Any CPU
{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{7C6961C8-3576-4499-92B6-3B5D798BDBFC} = {851D9BA2-9C00-4769-84BA-AD8A168F733E}
{17AF49CB-38AF-484D-9151-B470F320221D} = {851D9BA2-9C00-4769-84BA-AD8A168F733E}
{CAE3C5E6-7BBB-4673-BF70-7AA012A57F2C} = {851D9BA2-9C00-4769-84BA-AD8A168F733E}
EndGlobalSection
GlobalSection(MonoDevelopProperties) = preSolution
Policies = $0
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
using System;
using System.Configuration;

namespace CallfireApiClient.IntegrationTests.Api
{
public class AbstractIntegrationTest
{
protected CallfireClient Client;

private string apiUserName;

private string apiUserPassword;

public AbstractIntegrationTest()
{
ReadAllSettings();
Client = new CallfireClient(apiUserName, apiUserPassword);
}

private void ReadAllSettings()
{
try
{
var appSettings = ConfigurationManager.AppSettings;
if (appSettings.Count == 0)
{
Console.WriteLine("AppSettings is empty.");
}
else
{
apiUserName = appSettings["testLogin"];
apiUserPassword = appSettings["testPassword"];
}
}
catch (ConfigurationErrorsException)
{
Console.WriteLine("Error reading app settings");
}
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using CallfireApiClient.Api.Common.Model;
using CallfireApiClient.Api.Account.Model.Request;

namespace CallfireApiClient.Tests.Integration.Account
namespace CallfireApiClient.IntegrationTests.Api.Account
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class MeApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
using CallfireApiClient.Api.Numbers.Model.Request;
using System.Collections.Generic;

namespace CallfireApiClient.Tests.Integration.Account
namespace CallfireApiClient.IntegrationTests.Api.Account
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class OrdersApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
using CallfireApiClient.Api.Campaigns.Model;
using System.IO;

namespace CallfireApiClient.Tests.Integration.CallsTexts
namespace CallfireApiClient.IntegrationTests.Api.CallsTexts
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class CallsApiIntegrationTest : AbstractIntegrationTest
{

Expand Down Expand Up @@ -101,7 +101,7 @@ public void GetCallRecording()
[Test]
public void GetCallRecordingInMp3Format()
{
string mp3FilePath = "Integration/Resources/File-examples/testDownloadRecordingById.mp3";
string mp3FilePath = "Resources/File-examples/testDownloadRecordingById.mp3";
MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3(1);
File.WriteAllBytes(mp3FilePath, ms.ToArray());
}
Expand Down Expand Up @@ -139,7 +139,7 @@ public void GetCallRecordingByName()
public void CallRecordingMp3ByName()
{
CallRecording rec = Client.CallsApi.GetCallRecording(18666772003);
string mp3FilePath = "Integration/Resources/File-examples/testDownloadRecordingByName.mp3";
string mp3FilePath = "Resources/File-examples/testDownloadRecordingByName.mp3";
MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3ByName((long) rec.CallId, rec.Name);
File.WriteAllBytes(mp3FilePath, ms.ToArray());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@
using NUnit.Framework;
using System.IO;

namespace CallfireApiClient.Tests.Integration.CallsTexts
namespace CallfireApiClient.IntegrationTests.Api.CallsTexts
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class MediaApiIntegrationTest : AbstractIntegrationTest
{
private const string mp3FilePath = "Integration/Resources/File-examples/train1.mp3";
private const string wavFilePath = "Integration/Resources/File-examples/train1.wav";
private const string mp3FilePath = "Resources/File-examples/train1.mp3";
private const string wavFilePath = "Resources/File-examples/train1.wav";

[Test]
public void TestUpload()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@
using NUnit.Framework;
using CallfireApiClient.Api.Common.Model.Request;

namespace CallfireApiClient.Tests.Integration.CallsTexts

namespace CallfireApiClient.IntegrationTests.Api.CallsTexts
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class TextsApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
using System;
using NUnit.Framework;

namespace CallfireApiClient.Tests.Integration.Campaigns
namespace CallfireApiClient.IntegrationTests.Api.Campaigns
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class BatchesApiTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using CallfireApiClient.Api.Campaigns.Model.Request;
using CallfireApiClient.Api.Common.Model.Request;

namespace CallfireApiClient.Tests.Integration.Campaigns
namespace CallfireApiClient.IntegrationTests.Api.Campaigns
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class CallBroadcastsApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
using CallfireApiClient.Api.Common.Model;
using System.IO;

namespace CallfireApiClient.Tests.Integration.Campaigns
namespace CallfireApiClient.IntegrationTests.Api.Campaigns
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class CampaignSoundsApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down Expand Up @@ -49,8 +49,8 @@ public void TestUploadMp3WavFilesAndGetThem()
{
String soundName = "mp3_test_" + DateTime.Now.ToString();

string mp3FilePath = "Integration/Resources/File-examples/train1.mp3";
string wavFilePath = "Integration/Resources/File-examples/train1.wav";
string mp3FilePath = "Resources/File-examples/train1.mp3";
string wavFilePath = "Resources/File-examples/train1.wav";
ResourceId mp3ResourceId = Client.CampaignSoundsApi.Upload(mp3FilePath, soundName);
ResourceId wavResourceId = Client.CampaignSoundsApi.Upload(wavFilePath);

Expand All @@ -66,13 +66,13 @@ public void TestUploadMp3WavFilesAndGetThem()

// get mp3
MemoryStream ms = (MemoryStream)Client.CampaignSoundsApi.GetMp3(mp3ResourceId.Id);
string existingFilePath = Path.GetFullPath("Integration/Resources/File-examples/train1.mp3");
string existingFilePath = Path.GetFullPath("Resources/File-examples/train1.mp3");
string pathToSaveNewFile = existingFilePath.Replace("train.mp3", "mp3_sound.mp3");
File.WriteAllBytes(pathToSaveNewFile, ms.ToArray());

// get wav
ms = (MemoryStream)Client.CampaignSoundsApi.GetWav(wavResourceId.Id);
existingFilePath = Path.GetFullPath("Integration/Resources/File-examples/train1.wav");
existingFilePath = Path.GetFullPath("Resources/File-examples/train1.wav");
pathToSaveNewFile = existingFilePath.Replace("train.wav", "wav_sound.wav");
File.WriteAllBytes(pathToSaveNewFile, ms.ToArray());

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using CallfireApiClient.Api.Campaigns.Model;
using CallfireApiClient.Api.Campaigns.Model.Request;

namespace CallfireApiClient.Tests.Integration.Campaigns
namespace CallfireApiClient.IntegrationTests.Api.Campaigns
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class TextAutoRepliesApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
using CallfireApiClient.Api.Campaigns.Model.Request;
using CallfireApiClient.Api.Common.Model.Request;

namespace CallfireApiClient.Tests.Integration.Campaigns
namespace CallfireApiClient.IntegrationTests.Api.Campaigns
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class TextBroadcastsApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
using System.Collections.Generic;
using CallfireApiClient.Api.Common.Model.Request;

namespace CallfireApiClient.Tests.Integration.Contacts
namespace CallfireApiClient.IntegrationTests.Api.Contacts
{
[TestFixture, Ignore("temporary disabled")]
[TestFixture]
public class ContactListsApiIntegrationTest : AbstractIntegrationTest
{
[Test]
Expand Down
Loading