Skip to content

Commit 0628450

Browse files
committed
vmalinovskiy - updated client to last api version
1 parent 10163a3 commit 0628450

File tree

59 files changed

+1327
-82
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1327
-82
lines changed

CallfireApiClient.nuspec

Lines changed: 17 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.7</version>
4+
<version>1.1.8</version>
55
<title>CallFire API v2 client</title>
66
<authors>
77
Vladimir Mikhailov
@@ -15,9 +15,22 @@
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.8 - May 27 2016
19+
- defaultLiveMessage, defaultMachineMessage, defaultLiveMessageSoundId, defaultMachineMessageSoundId, defaultVoice params added to send calls api
20+
- added batch id filter parameter for get broadcast calls/texts
21+
- added fields filter parameter for add sound via call, returns CampaignSound object
22+
- added fields filter parameter for add sound via text-to-speech, returns CampaignSound object
23+
- defaultMessage parameter added to send texts function
24+
- added findWebhookResource and findWebhookResources methods to use new webhooks apis
25+
- resumeNextDay parameter added to CallBroadcast object
26+
- transferMessage, transferMessageSoundId, transferDigit, transferNumber params added to CallRecipient object for sending calls and texts
27+
- added questionResponses parameter to CallRecord object
28+
- added duplicate parameter to CampaignSound object
29+
- get call recordings api functions implemented in CallsApi
30+
1831
Version 1.1.7 - Apr 18 2016
1932
- migration to 4.5 net framework
20-
- migration to gradle
33+
- migration to gradle
2134

2235
Version 1.1.6 - Mar 25 2016
2336
- added mono debug files generation on Windows platform
@@ -60,5 +73,7 @@ Version 1.0.0 - Dec 29 2015
6073
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.dll" target="lib"/>
6174
<file src="src/CallfireApiClient/bin/Release/callfire-api-client.dll.config" target="lib"/>
6275
<file src="src/CallfireApiClient/bin/Release/callfire-api-client.xml" target="lib"/>
76+
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.pdb" target="lib"/>
77+
<file src="src/CallfireApiClient/bin/Debug/callfire-api-client.dll.mdb" target="lib"/>
6378
</files>
6479
</package>

Changelog.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,21 @@
11
Callfire API client Changelog
22
=============================
3+
Version 1.1.8 - May 27 2016
4+
- defaultLiveMessage, defaultMachineMessage, defaultLiveMessageSoundId, defaultMachineMessageSoundId, defaultVoice params added to send calls api
5+
- added batch id filter parameter for get broadcast calls/texts
6+
- added fields filter parameter for add sound via call, returns CampaignSound object
7+
- added fields filter parameter for add sound via text-to-speech, returns CampaignSound object
8+
- defaultMessage parameter added to send texts function
9+
- added findWebhookResource and findWebhookResources methods to use new webhooks apis
10+
- resumeNextDay parameter added to CallBroadcast object
11+
- transferMessage, transferMessageSoundId, transferDigit, transferNumber params added to CallRecipient object for sending calls and texts
12+
- added questionResponses parameter to CallRecord object
13+
- added duplicate parameter to CampaignSound object
14+
- get call recordings api functions implemented in CallsApi
15+
316
Version 1.1.7 - Apr 18 2016
417
- migration to 4.5 net framework
5-
- migration to gradle
18+
- migration to gradle
619

720
Version 1.1.6 - Mar 25 2016
821
- added mono debug files generation on Windows platform

docs/api/callstexts/CallsApi.adoc

Lines changed: 78 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,15 @@ Example how to use the /calls API to quickly send individual calls via default c
2525
[source,csharp]
2626
CallfireClient Client = new CallfireClient("api_login", "api_password");
2727
//Only "recipients" param required
28-
var recipient1 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage" };
29-
var recipient2 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage" };
28+
var recipient1 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage", TransferDigit = "1", TransferMessage = "transferTestMessage", TransferNumber = "14246525473" };
29+
var recipient2 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage", TransferDigit = "1", TransferMessageSoundId = 1, TransferNumber = "14246525473" };
30+
r1.setTransferMessage("transferTestMessage");
31+
//or you can use transfer sound id
32+
r1.setTransferMessageSoundId(1123123L);
33+
r1.setTransferNumber("14246525473");
34+
r1.setTransferDigit("1");
35+
36+
3037
var recipients = new List<CallRecipient> { recipient1, recipient2 };
3138
IList<Call> calls = Client.CallsApi.Send(recipients, null, "items(id,fromNumber,state)");
3239
Console.WriteLine("Calls: " + calls);
@@ -42,6 +49,35 @@ In case you want to send call via existing campaign provide campaign id as secon
4249
IList<Call> calls = Client.CallsApi.Send(recipients, 60000000003);
4350
Console.WriteLine("Calls: " + calls);
4451

52+
Also you can send call with some default parameters which will be used in case when recipient doesn't have that info specified,
53+
see example below:
54+
[source,csharp]
55+
CallfireClient Client = new CallfireClient("api_login", "api_password");
56+
//Only "recipients" param required
57+
var recipient1 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage" };
58+
var recipient2 = new CallRecipient { ContactId = 463633187003, LiveMessage = "testMessage" };
59+
var recipients = new List<CallRecipient> { recipient1, recipient2 };
60+
var request = new SendCallsRequest
61+
{
62+
Recipients = recipients,
63+
CampaignId = 7373471003,
64+
Fields = "items(id, fromNumber, state, campaignId)",
65+
DefaultLiveMessage = "DefaultLiveMessage",
66+
DefaultMachineMessage = "DefaultMachineMessage",
67+
DefaultVoice = CallfireApiClient.Api.Campaigns.Model.Voice.FRENCHCANADIAN1
68+
};
69+
IList<Call> calls = Client.CallsApi.Send(request);
70+
request = new SendCallsRequest
71+
{
72+
Recipients = recipients,
73+
CampaignId = 7373471003,
74+
Fields = "items(id, fromNumber, state, campaignId)",
75+
DefaultLiveMessageSoundId = 1,
76+
DefaultMachineMessageSoundId = 1,
77+
DefaultVoice = CallfireApiClient.Api.Campaigns.Model.Voice.FRENCHCANADIAN1
78+
};
79+
calls = Client.CallsApi.Send(request);
80+
4581
=== Get call
4682
'''
4783
Example how to return a single Call instance for a given call id.
@@ -50,3 +86,43 @@ Example how to return a single Call instance for a given call id.
5086
CallfireClient Client = new CallfireClient("api_login", "api_password");
5187
Call call = Client.CallsApi.Get(617067920003, "id,toNumber,state");
5288
Console.WriteLine("Call: " + call);
89+
90+
=== Get call recordings
91+
'''
92+
Example how to return call recordings for a given call id.
93+
[source,csharp]
94+
//Only "id" param required
95+
CallfireClient Client = new CallfireClient("api_login", "api_password");
96+
IList<CallRecording> recs = Client.CallsApi.GetCallRecordings(1234, "items(callId)");
97+
98+
=== Get call recording by name and call id
99+
'''
100+
Example how to return call recording for a given call by recording name.
101+
[source,csharp]
102+
//"id" and "name" params are required
103+
CallfireClient Client = new CallfireClient("api_login", "api_password");
104+
CallRecording recording = Client.CallsApi.GetCallRecordingByName(1234, "testName", "callId");
105+
106+
=== Get mp3 call recording by name and call id
107+
'''
108+
Example how to return mp3 call recording for a given call by recording name.
109+
[source,csharp]
110+
//"id" and "name" params are required
111+
CallfireClient Client = new CallfireClient("api_login", "api_password");
112+
MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3ByName(1234, "testName");
113+
114+
=== Get call recording by id
115+
'''
116+
Example how to return call recording for a given recording id.
117+
[source,csharp]
118+
//Only "id" param required
119+
CallfireClient Client = new CallfireClient("api_login", "api_password");
120+
CallRecording rec = Client.CallsApi.GetCallRecording(1234, "campaignId");
121+
122+
=== Get mp3 call recording by id
123+
'''
124+
Example how to return mp3 call recording for a given recording id.
125+
[source,csharp]
126+
//Only "id" param required
127+
CallfireClient Client = new CallfireClient("api_login", "api_password");
128+
MemoryStream ms = (MemoryStream)Client.CallsApi.GetCallRecordingMp3(1234);

docs/api/callstexts/TextsApi.adoc

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,23 @@ Example how to use the /texts API to quickly send individual texts via existing
3030

3131
In case you want to send text via default campaign use *Send(List<TextRecipient> recipients, long? campaignId)* method.
3232

33+
In case you want to send text with default text which will be used in case when recipient doesn't have that info specified,
34+
see example below:
35+
[source,csharp]
36+
CallfireClient Client = new CallfireClient("api_login", "api_password");
37+
//Only "recipients" param required
38+
var recipient1 = new TextRecipient { Message = "msg", PhoneNumber = "12132212384" };
39+
var recipient2 = new TextRecipient { Message = "msg", PhoneNumber = "12132212384" };
40+
var recipients = new List<TextRecipient> { recipient1, recipient2 };
41+
var request = new SendTextsRequest
42+
{
43+
Recipients = recipients,
44+
CampaignId = 7415135003,
45+
DefaultMessage = "DefaultLiveMessage",
46+
Fields = "items(id,fromNumber,state)"
47+
};
48+
IList<Text> texts = Client.TextsApi.Send(request);
49+
3350
=== Get text
3451
'''
3552
Example how to return a single Text instance for a given text id.

docs/api/campaigns/CallBroadcastsApi.adoc

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,9 @@ Create a call broadcast campaign using the Call Broadcast API. Send a CallBroadc
3737
{
3838
new Recipient { PhoneNumber = "12132212384" },
3939
new Recipient { PhoneNumber = "12132212385" }
40-
}
40+
},
41+
ResumeNextDay = true
42+
4143
};
4244
// create broadcast with 'start' argument = true to start campaign immediately
4345
var id = client.CallBroadcastsApi.Create(broadcast, true);
@@ -94,6 +96,13 @@ Get calls associated with call broadcast ordered by date.
9496
var calls = client.CallBroadcastsApi.GetCalls(request);
9597
Console.WriteLine(calls);
9698

99+
If you want to get calls filtered by batch id please use code like:
100+
[source,csharp]
101+
var client = new CallfireClient("api_login", "api_password");
102+
var request = new GetBroadcastCallsTextsRequest { Id = 1234, batchId = 12345 };
103+
var calls = client.CallBroadcastsApi.GetCalls(getCallsRequest);
104+
Console.WriteLine(calls);
105+
97106
=== Get broadcast stats
98107
Get broadcast statistics.
99108
[source,csharp]

docs/api/campaigns/CampaignSoundsApi.adoc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,17 @@ Use this API to create a sound via phone call. Supply the required phone number
5050
};
5151
ResourceId resourceId = Client.CampaignSoundsApi.RecordViaPhone(callCreateSound);
5252
Console.WriteLine("Sound id: " + resourceId.Id);
53-
53+
54+
If you want to see created sound details please use code like:
55+
[source,csharp]
56+
CallfireClient Client = new CallfireClient("api_login", "api_password");
57+
CallCreateSound callCreateSound = new CallCreateSound
58+
{
59+
Name = "call_in_sound_" + new DateTime().Millisecond,
60+
ToNumber = "12132212384"
61+
};
62+
CampaignSound sound = Client.CampaignSoundsApi.RecordViaPhoneAndGetSoundDetails(callCreateSound, "id,name");
63+
5464
=== Add sound via text-to-speech
5565
'''
5666
Use this API to create a sound file via a supplied string of text. Send the required text in the
@@ -62,3 +72,17 @@ Use this API to create a sound file via a supplied string of text. Send the requ
6272
ResourceId resourceId = Client.CampaignSoundsApi.CreateFromTts(tts);
6373
CampaignSound campaignSound = Client.CampaignSoundsApi.Get(resourceId.Id);
6474
Console.WriteLine("Campaign sound: " + campaignSound);
75+
76+
If you want to see created sound details please use code like:
77+
[source,csharp]
78+
CallfireClient Client = new CallfireClient("api_login", "api_password");
79+
TextToSpeech tts = new TextToSpeech { Message = "this is TTS message from csharp client" };
80+
CampaignSound sound = Client.CampaignSoundsApi.CreateFromTtsAndGetSoundDetails(tts, "id,name");
81+
82+
=== Upload sound file
83+
'''
84+
Upload mp3 or wav sound file.
85+
[source,csharp]
86+
CallfireClient Client = new CallfireClient("api_login", "api_password");
87+
string mp3FilePath = "Resources/File-examples/train.mp3";
88+
CampaignSound mp3Resource = Client.CampaignSoundsApi.UploadAndGetSoundDetails(mp3FilePath, "fileName");

docs/api/campaigns/TextBroadcastsApi.adoc

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@ Example how to create text broadcast and then start it. Broadcast will send mess
3838
{
3939
new TextRecipient { PhoneNumber = "12132212384" },
4040
new TextRecipient { PhoneNumber = "12132212385" }
41-
}
41+
},
42+
ResumeNextDay = true
4243
};
4344
// create broadcast
4445
var id = client.TextBroadcastsApi.Create(broadcast, true);
@@ -87,6 +88,12 @@ This operation will enable the user to page through all of the texts for a parti
8788
var texts = client.TextBroadcastsApi.GetTexts(request);
8889
Console.WriteLine(texts);
8990

91+
If you want to get texts filtered by batch id please use code like:
92+
[source,csharp]
93+
var client = new CallfireClient("api_login", "api_password");
94+
var request = new GetBroadcastCallsTextsRequest { Id = 123, batchId = 1234 };
95+
var texts = client.TextBroadcastsApi.GetTexts(request);
96+
9097
=== Get broadcast stats
9198
Get broadcast statistics.
9299
[source,csharp]

docs/api/webhooks/WebhooksApi.adoc

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ Search for webhooks on name, resource, event, callback URL, or whether they are
1111
{
1212
Limit = 5,
1313
Enabled = true,
14-
Resource = Webhook.ResourceType.TEXT_BROADCAST
14+
Name = "test_name"
1515
};
1616
Page<Webhook> webhooks = Client.WebhooksApi.Find(findRequest);
1717
Console.WriteLine(webhooks);
@@ -33,7 +33,7 @@ Example how to create a webhook for voice campaign. Callfire will query your cal
3333
var webhook = new Webhook
3434
{
3535
Name = "new webhook",
36-
Resource = ResourceType.VOICE_BROADCAST,
36+
Resource = ResourceType.TEXT_BROADCAST,
3737
Events = new HashSet<ResourceEvent> { ResourceEvent.STARTED, ResourceEvent.FINISHED },
3838
Callback = "https://yoursite.com/callback"
3939
};
@@ -49,7 +49,7 @@ Example how to update the information in a currently existing webhook. Most fiel
4949
{
5050
Id = 12345678,
5151
Name = "new webhook",
52-
Resource = ResourceType.VOICE_BROADCAST,
52+
Resource = ResourceType.TEXT_BROADCAST,
5353
Events = new HashSet<ResourceEvent> { ResourceEvent.STARTED, ResourceEvent.FINISHED },
5454
Callback = "https://yoursite.com/callback"
5555
};
@@ -61,3 +61,17 @@ Example how to delete a webhook. Will be removed permenantly.
6161
[source,csharp]
6262
CallfireClient Client = new CallfireClient("api_login", "api_password");
6363
Client.WebhooksApi.Delete(12345678);
64+
65+
=== Find webhook resources
66+
'''
67+
Example how to find webhook resources.
68+
[source,csharp]
69+
CallfireClient Client = new CallfireClient("api_login", "api_password");
70+
var resources = Client.WebhooksApi.FindWebhookResources("items(resource)");
71+
72+
=== Find webhook resource
73+
'''
74+
Example how to find webhook resource.
75+
[source,csharp]
76+
CallfireClient Client = new CallfireClient("api_login", "api_password");
77+
var resource = Client.WebhooksApi.FindWebhookResource(ResourceType.CALL_BROADCAST, "resource");
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
using System.Collections.Generic;
2+
using CallfireApiClient.Api.Campaigns.Model;
3+
4+
namespace CallfireApiClient.Tests.Api.CallsTexts
5+
{
6+
internal class CallRecording<T>
7+
{
8+
private IList<CallRecording> callRecordings;
9+
10+
public CallRecording(IList<CallRecording> callRecordings)
11+
{
12+
this.callRecordings = callRecordings;
13+
}
14+
}
15+
}

0 commit comments

Comments
 (0)