Skip to content

Commit becb0e8

Browse files
First implementation of the Infobip API C# client lib with examples
1 parent b7e0b13 commit becb0e8

File tree

114 files changed

+5367
-0
lines changed

Some content is hidden

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

114 files changed

+5367
-0
lines changed

.gitattributes

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
###############################################################################
2+
# Set default behavior to automatically normalize line endings.
3+
###############################################################################
4+
* text=auto
5+
6+
###############################################################################
7+
# Set default behavior for command prompt diff.
8+
#
9+
# This is need for earlier builds of msysgit that does not have it on by
10+
# default for csharp files.
11+
# Note: This is only used by command line
12+
###############################################################################
13+
#*.cs diff=csharp
14+
15+
###############################################################################
16+
# Set the merge driver for project and solution files
17+
#
18+
# Merging from the command prompt will add diff markers to the files if there
19+
# are conflicts (Merging from VS is not affected by the settings below, in VS
20+
# the diff markers are never inserted). Diff markers may cause the following
21+
# file extensions to fail to load in VS. An alternative would be to treat
22+
# these files as binary and thus will always conflict and require user
23+
# intervention with every merge. To do so, just uncomment the entries below
24+
###############################################################################
25+
#*.sln merge=binary
26+
#*.csproj merge=binary
27+
#*.vbproj merge=binary
28+
#*.vcxproj merge=binary
29+
#*.vcproj merge=binary
30+
#*.dbproj merge=binary
31+
#*.fsproj merge=binary
32+
#*.lsproj merge=binary
33+
#*.wixproj merge=binary
34+
#*.modelproj merge=binary
35+
#*.sqlproj merge=binary
36+
#*.wwaproj merge=binary
37+
38+
###############################################################################
39+
# behavior for image files
40+
#
41+
# image files are treated as binary by default.
42+
###############################################################################
43+
#*.jpg binary
44+
#*.png binary
45+
#*.gif binary
46+
47+
###############################################################################
48+
# diff behavior for common document formats
49+
#
50+
# Convert binary document formats to text before diffing them. This feature
51+
# is only available from the command line. Turn it on by uncommenting the
52+
# entries below.
53+
###############################################################################
54+
#*.doc diff=astextplain
55+
#*.DOC diff=astextplain
56+
#*.docx diff=astextplain
57+
#*.DOCX diff=astextplain
58+
#*.dot diff=astextplain
59+
#*.DOT diff=astextplain
60+
#*.pdf diff=astextplain
61+
#*.PDF diff=astextplain
62+
#*.rtf diff=astextplain
63+
#*.RTF diff=astextplain

InfobipClient/InfobipClient.sln

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
2+
Microsoft Visual Studio Solution File, Format Version 12.00
3+
# Visual Studio 15
4+
VisualStudioVersion = 15.0.27004.2005
5+
MinimumVisualStudioVersion = 10.0.40219.1
6+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfobipClientLib", "InfobipClientLib\InfobipClientLib.csproj", "{95264B1B-6EFA-4791-A75F-481464FD5CD3}"
7+
EndProject
8+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "InfobipClientExamples", "InfobipClientExamples\InfobipClientExamples.csproj", "{20C0C73C-67B2-461D-A34D-F4686367493C}"
9+
EndProject
10+
Global
11+
GlobalSection(SolutionConfigurationPlatforms) = preSolution
12+
Debug|Any CPU = Debug|Any CPU
13+
Release|Any CPU = Release|Any CPU
14+
EndGlobalSection
15+
GlobalSection(ProjectConfigurationPlatforms) = postSolution
16+
{95264B1B-6EFA-4791-A75F-481464FD5CD3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17+
{95264B1B-6EFA-4791-A75F-481464FD5CD3}.Debug|Any CPU.Build.0 = Debug|Any CPU
18+
{95264B1B-6EFA-4791-A75F-481464FD5CD3}.Release|Any CPU.ActiveCfg = Release|Any CPU
19+
{95264B1B-6EFA-4791-A75F-481464FD5CD3}.Release|Any CPU.Build.0 = Release|Any CPU
20+
{20C0C73C-67B2-461D-A34D-F4686367493C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21+
{20C0C73C-67B2-461D-A34D-F4686367493C}.Debug|Any CPU.Build.0 = Debug|Any CPU
22+
{20C0C73C-67B2-461D-A34D-F4686367493C}.Release|Any CPU.ActiveCfg = Release|Any CPU
23+
{20C0C73C-67B2-461D-A34D-F4686367493C}.Release|Any CPU.Build.0 = Release|Any CPU
24+
EndGlobalSection
25+
GlobalSection(SolutionProperties) = preSolution
26+
HideSolutionNode = FALSE
27+
EndGlobalSection
28+
GlobalSection(ExtensibilityGlobals) = postSolution
29+
SolutionGuid = {2E96FF84-92DF-4745-A03B-714602A0FAD7}
30+
EndGlobalSection
31+
EndGlobal
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
<?xml version="1.0" encoding="utf-8" ?>
2+
<configuration>
3+
<startup>
4+
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.5" />
5+
</startup>
6+
</configuration>
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
using InfobipClientExamples.examples;
2+
3+
namespace InfobipClientExamples
4+
{
5+
class ExampleRunner
6+
{
7+
static void Main(string[] args)
8+
{
9+
// Uncomment an example to run it
10+
11+
//new AdvancedSmsDeliveryTimeWindowExample().RunExample();
12+
//new AdvancedSmsExample().RunExample();
13+
//new AdvancedSmsFlashExample().RunExample();
14+
//new AdvancedSmsLanguageExample().RunExample();
15+
//new AdvancedSmsNotifyExample().RunExample();
16+
//new AdvancedSmsSchedulingExample().RunExample();
17+
//new AdvancedSmsTrackingExample().RunExample();
18+
19+
//new GetAccountBalanceExample().RunExample();
20+
21+
//new GetInboxLogsExample().RunExample();
22+
//new GetSentLogsDeliveredExample().RunExample();
23+
//new GetSentLogsExample().RunExample();
24+
25+
//new LogEndTagExample().RunExample();
26+
27+
//new NumberContextNotifyExample().RunExample();
28+
//new NumberContextQueryExample().RunExample();
29+
30+
//new PullInboxDeliveryReportsExample().RunExample();
31+
//new PullSentDeliveryReportsExample().RunExample();
32+
33+
//new SingleTextualSmsExample().RunExample();
34+
35+
//new SmsPreviewExample().RunExample();
36+
}
37+
}
38+
}
Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
4+
<PropertyGroup>
5+
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
6+
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
7+
<ProjectGuid>{20C0C73C-67B2-461D-A34D-F4686367493C}</ProjectGuid>
8+
<OutputType>Exe</OutputType>
9+
<RootNamespace>InfobipClientExamples</RootNamespace>
10+
<AssemblyName>InfobipClientExamples</AssemblyName>
11+
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
12+
<FileAlignment>512</FileAlignment>
13+
</PropertyGroup>
14+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
15+
<PlatformTarget>AnyCPU</PlatformTarget>
16+
<DebugSymbols>true</DebugSymbols>
17+
<DebugType>full</DebugType>
18+
<Optimize>false</Optimize>
19+
<OutputPath>bin\Debug\</OutputPath>
20+
<DefineConstants>DEBUG;TRACE</DefineConstants>
21+
<ErrorReport>prompt</ErrorReport>
22+
<WarningLevel>4</WarningLevel>
23+
</PropertyGroup>
24+
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
25+
<PlatformTarget>AnyCPU</PlatformTarget>
26+
<DebugType>pdbonly</DebugType>
27+
<Optimize>true</Optimize>
28+
<OutputPath>bin\Release\</OutputPath>
29+
<DefineConstants>TRACE</DefineConstants>
30+
<ErrorReport>prompt</ErrorReport>
31+
<WarningLevel>4</WarningLevel>
32+
</PropertyGroup>
33+
<ItemGroup>
34+
<None Include="App.config" />
35+
<None Include="packages.config" />
36+
</ItemGroup>
37+
<ItemGroup>
38+
<ProjectReference Include="..\InfobipClientLib\InfobipClientLib.csproj">
39+
<Project>{95264b1b-6efa-4791-a75f-481464fd5cd3}</Project>
40+
<Name>InfobipClientLib</Name>
41+
</ProjectReference>
42+
</ItemGroup>
43+
<ItemGroup>
44+
<Compile Include="ExampleRunner.cs" />
45+
<Compile Include="examples\AdvancedSmsDeliveryTimeWindowExample.cs" />
46+
<Compile Include="examples\AdvancedSmsExample.cs" />
47+
<Compile Include="examples\AdvancedSmsFlashExample.cs" />
48+
<Compile Include="examples\AdvancedSmsLanguageExample.cs" />
49+
<Compile Include="examples\AdvancedSmsNotifyExample.cs" />
50+
<Compile Include="examples\AdvancedSmsSchedulingExample.cs" />
51+
<Compile Include="examples\AdvancedSmsTrackingExample.cs" />
52+
<Compile Include="examples\Example.cs" />
53+
<Compile Include="examples\GetAccountBalanceExample.cs" />
54+
<Compile Include="examples\GetInboxLogsExample.cs" />
55+
<Compile Include="examples\GetSentLogsDeliveredExample.cs" />
56+
<Compile Include="examples\GetSentLogsExample.cs" />
57+
<Compile Include="examples\LogEndTagExample.cs" />
58+
<Compile Include="examples\NumberContextNotifyExample.cs" />
59+
<Compile Include="examples\NumberContextQueryExample.cs" />
60+
<Compile Include="examples\PullInboxDeliveryReportsExample.cs" />
61+
<Compile Include="examples\PullSentDeliveryReportsExample.cs" />
62+
<Compile Include="examples\SingleTextualSmsExample.cs" />
63+
<Compile Include="examples\SmsPreviewExample.cs" />
64+
</ItemGroup>
65+
<ItemGroup>
66+
<Reference Include="Newtonsoft.Json, Version=10.0.0.0, Culture=neutral, PublicKeyToken=30ad4fe6b2a6aeed, processorArchitecture=MSIL">
67+
<HintPath>..\packages\Newtonsoft.Json.10.0.3\lib\net45\Newtonsoft.Json.dll</HintPath>
68+
</Reference>
69+
</ItemGroup>
70+
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
71+
</Project>
Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
using InfobipClient.infobip.api.client;
2+
using InfobipClient.infobip.api.model;
3+
using InfobipClient.infobip.api.model.sms.mt.send;
4+
using InfobipClient.infobip.api.model.sms.mt.send.textual;
5+
using System;
6+
using System.Collections.Generic;
7+
8+
namespace InfobipClientExamples.examples
9+
{
10+
class AdvancedSmsDeliveryTimeWindowExample : Example
11+
{
12+
public override void RunExample()
13+
{
14+
string messageId = AdvancedSms();
15+
16+
System.Threading.Thread.Sleep(3000);
17+
18+
GetSmsReport(messageId);
19+
}
20+
21+
private static string AdvancedSms()
22+
{
23+
Console.WriteLine("-------------------------------");
24+
Console.WriteLine("Sending fully featured textual message with delivery time window...");
25+
26+
SendMultipleTextualSmsAdvanced smsClient = new SendMultipleTextualSmsAdvanced(BASIC_AUTH_CONFIGURATION);
27+
28+
Destination destination = new Destination
29+
{
30+
To = TO
31+
};
32+
33+
Message message = new Message
34+
{
35+
From = FROM,
36+
Destinations = new List<Destination>(1) { destination },
37+
Text = "Advanced message example",
38+
DeliveryTimeWindow = generateDeliveryTimeWindow()
39+
};
40+
41+
SMSAdvancedTextualRequest request = new SMSAdvancedTextualRequest
42+
{
43+
Messages = new List<Message>(1) { message }
44+
};
45+
46+
SMSResponse smsResponse = smsClient.Execute(request);
47+
48+
Console.WriteLine("Sending fully featured textual message with delivery time window complete.");
49+
50+
SMSResponseDetails sentMessageInfo = smsResponse.Messages[0];
51+
Console.WriteLine("-------------------------------");
52+
Console.WriteLine("Message ID: " + sentMessageInfo.MessageId);
53+
Console.WriteLine("Receiver: " + sentMessageInfo.To);
54+
Console.WriteLine("Message status: " + sentMessageInfo.Status.Name);
55+
Console.WriteLine("-------------------------------");
56+
57+
return sentMessageInfo.MessageId;
58+
}
59+
60+
private static DeliveryTimeWindow generateDeliveryTimeWindow()
61+
{
62+
DeliveryTime deliveryTimeFrom = new DeliveryTime
63+
{
64+
Hour = 3,
65+
Minute = 30
66+
};
67+
68+
DeliveryTime deliveryTimeTo = new DeliveryTime
69+
{
70+
Hour = 23,
71+
Minute = 45
72+
};
73+
74+
List<DeliveryDay> deliveryDays = new List<DeliveryDay>
75+
{
76+
DeliveryDay.MONDAY,
77+
DeliveryDay.TUESDAY,
78+
DeliveryDay.WEDNESDAY,
79+
DeliveryDay.THURSDAY,
80+
DeliveryDay.FRIDAY,
81+
DeliveryDay.SATURDAY,
82+
DeliveryDay.SUNDAY
83+
};
84+
85+
DeliveryTimeWindow deliveryTimeWindow = new DeliveryTimeWindow
86+
{
87+
From = deliveryTimeFrom,
88+
To = deliveryTimeTo,
89+
Days = deliveryDays
90+
};
91+
return deliveryTimeWindow;
92+
}
93+
}
94+
}
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
using InfobipClient.infobip.api.client;
2+
using InfobipClient.infobip.api.model;
3+
using InfobipClient.infobip.api.model.sms.mt.send;
4+
using InfobipClient.infobip.api.model.sms.mt.send.textual;
5+
using System;
6+
using System.Collections.Generic;
7+
8+
namespace InfobipClientExamples.examples
9+
{
10+
class AdvancedSmsExample : Example
11+
{
12+
public override void RunExample()
13+
{
14+
string messageId = AdvancedSms();
15+
16+
System.Threading.Thread.Sleep(2000);
17+
18+
GetSmsReport(messageId);
19+
}
20+
21+
private static string AdvancedSms()
22+
{
23+
Console.WriteLine("-------------------------------");
24+
Console.WriteLine("Sending fully featured textual message...");
25+
26+
SendMultipleTextualSmsAdvanced smsClient = new SendMultipleTextualSmsAdvanced(BASIC_AUTH_CONFIGURATION);
27+
28+
Destination destination = new Destination
29+
{
30+
To = TO
31+
};
32+
33+
Message message = new Message
34+
{
35+
From = FROM,
36+
Destinations = new List<Destination>(1) { destination },
37+
Text = "Advanced message example"
38+
};
39+
40+
SMSAdvancedTextualRequest request = new SMSAdvancedTextualRequest
41+
{
42+
Messages = new List<Message>(1) { message }
43+
};
44+
45+
SMSResponse smsResponse = smsClient.Execute(request);
46+
47+
Console.WriteLine("Sending fully featured textual message complete.");
48+
49+
SMSResponseDetails sentMessageInfo = smsResponse.Messages[0];
50+
Console.WriteLine("-------------------------------");
51+
Console.WriteLine("Message ID: " + sentMessageInfo.MessageId);
52+
Console.WriteLine("Receiver: " + sentMessageInfo.To);
53+
Console.WriteLine("Message status: " + sentMessageInfo.Status.Name);
54+
Console.WriteLine("-------------------------------");
55+
56+
return sentMessageInfo.MessageId;
57+
}
58+
}
59+
}

0 commit comments

Comments
 (0)