GhasedakSms.Framework 1.0.5

dotnet add package GhasedakSms.Framework --version 1.0.5                
NuGet\Install-Package GhasedakSms.Framework -Version 1.0.5                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="GhasedakSms.Framework" Version="1.0.5" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GhasedakSms.Framework --version 1.0.5                
#r "nuget: GhasedakSms.Framework, 1.0.5"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install GhasedakSms.Framework as a Cake Addin
#addin nuget:?package=GhasedakSms.Framework&version=1.0.5

// Install GhasedakSms.Framework as a Cake Tool
#tool nuget:?package=GhasedakSms.Framework&version=1.0.5                

GhasedakSms.Framework

GhasedakSms.Framework is a .NET Framework library designed to interact with the Ghasedak SMS API, allowing you to send SMS, check statuses, and manage SMS-related functionalities efficiently.

Features

  • Send SMS: Supports sending single, bulk, and pair-to-pair SMS.
  • OTP Management: Easily send OTP messages with customizable parameters.
  • Receive SMS: Retrieve received messages with pagination support.
  • Account Information: Fetch account details like balance and other information.

Installation

Install the package via NuGet Package Manager:

dotnet add package GhasedakSms.Framework

Or using the NuGet Package Manager Console:

Install-Package GhasedakSms.Framework

Usage

1. Configuration

To start using the library, initialize the Ghasedak client with your API key:

var apiKey = "your_api_key";
var client = new Ghasedak(apiKey);

2. Fetch Account Information

Retrieve account information such as balance:

var accountInfo = await client.GetAccountInformation();

3. Receiving SMS

Retrieve Received SMS:
var receivedMessages = await client.GetReceivedSmses(new GetReceivedSmsInput
{
    LineNumber = "30005088",
    IsRead = true
});
Retrieve Received SMS with Pagination:
var receivedMessagesPaged = await client.GetReceivedSmsesPaging(new GetReceivedSmsPagingInput
{
    LineNumber = "30005088",
    IsRead = true,
    StartDate = DateTime.Now.AddDays(-7),
    EndDate = DateTime.Now,
    PageIndex = 1,
    PageSize = 10
});

4. OTP Operations

Fetch OTP Template Parameters:
var otpTemplate = await client.GetOtpParameters(new GetOtpParametersInput
{
    TemplateName = "Ghasedak"
});
Send OTP SMS:
var sendOtp = await client.SendOtpSMS(new SendOtpInput
{
    TemplateName = "Ghasedak",
    SendDate = DateTime.Now,
    Inputs = new List<OtpInput>
    {
        new OtpInput { Param = "Code", Value = "1234" },
    },
    Receptors = new List<SendOtpReceptorDto>
    {
        new SendOtpReceptorDto { ClientReferenceId = "testOtp1", Mobile = "0912*******" },
        new SendOtpReceptorDto { ClientReferenceId = "testOtp2", Mobile = "0912*******" }
    }
});
Send OTP with Predetermined Parameters

The SendOtpWithParams function allows you to send an OTP message using predetermined parameters.

var sendOtpWithParams = await client.SendOtpWithParams(new SendOtpWithParamsInput
{
    TemplateName = "otpTemplate",
    Param1 = "value1",
    Param2 = "value2",
    Param3 = "value3",
    Param4 = "value4",
    Param5 = "value5",
    Param6 = "value6",
    Param7 = "value7",
    Param8 = "value8",
    Param9 = "value9",
    Param10 = "value10",
    Receptors = new List<SendOtpReceptorDto>
    {
        new SendOtpReceptorDto { ClientReferenceId = "otpTest1", Mobile = "0912*******" },
        new SendOtpReceptorDto { ClientReferenceId = "otpTest1", Mobile = "0912*******" },
    },
    SendDate = DateTime.Now
});

5. Sending SMS

Send a Single SMS:
var sendSingle = await client.SendSingleSMS(new SendSingleSmsInput
{
    LineNumber = "30005088",
    ClientReferenceId = "testsingle",
    Message = "test single",
    Receptor = "0912*******",
    SendDate = DateTime.Now
});
Send Bulk SMS:
var sendBulk = await client.SendBulkSMS(new SendBulkInput
{
    LineNumber = "30005088",
    Message = "test bulk",
    Receptors = new List<string> { "0912*******", "0912*******" },
    ClientReferenceId = "testbulk",
    SendDate = DateTime.Now
});
Send Pair-to-Pair SMS:
var sendPair = await client.SendPairToPairSMS(new SendPairToPairInput
{
    Items = new List<SendPairToPairSmsWebServiceDto>
    {
        new SendPairToPairSmsWebServiceDto
        {
            ClientReferenceId = "testpair",
            LineNumber = "30005088",
            Message = "test pair to pair",
            Receptor = "0912*******",
            SendDate = DateTime.Now
        }
    }
});

6. Checking SMS Status

var statuses = await client.CheckSmsStatus(new CheckSmsStatusInput
{
    Type = MessageIdType.MessageId,
    Ids = new List<string> { "12345", "67890" } // Replace with actual Message IDs
});

Contributing

Contributions are welcome! Feel free to fork the repository, open issues, or submit pull requests.

License

This project is licensed under the MIT License - see the LICENSE file for details.

Contact

For any questions or support, please reach out to the Ghasedak team at support@ghasedak-ict.com.

Product Compatible and additional computed target framework versions.
.NET Framework net47 is compatible.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
1.0.5 101 8/13/2024
1.0.4 49 8/4/2024
1.0.3 43 8/4/2024
1.0.2 91 7/20/2024

Add readme.