GhasedakSms.Core 1.0.6.4

dotnet add package GhasedakSms.Core --version 1.0.6.4                
NuGet\Install-Package GhasedakSms.Core -Version 1.0.6.4                
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.Core" Version="1.0.6.4" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add GhasedakSms.Core --version 1.0.6.4                
#r "nuget: GhasedakSms.Core, 1.0.6.4"                
#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.Core as a Cake Addin
#addin nuget:?package=GhasedakSms.Core&version=1.0.6.4

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

GhasedakSms.Core

GhasedakSms.Core is a .NET Core 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.Core

Or using the NuGet Package Manager Console:

Install-Package GhasedakSms.Core

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 = "3000****",
    IsRead = true
});
Retrieve Received SMS with Pagination:
var receivedMessagesPaged = await client.GetReceivedSmsesPaging(new GetReceivedSmsPagingInput
{
    LineNumber = "3000****",
    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 = "3000****",
    ClientReferenceId = "testsingle",
    Message = "test single",
    Receptor = "0912*******",
    SendDate = DateTime.Now
});
Send Bulk SMS:
var sendBulk = await client.SendBulkSMS(new SendBulkInput
{
    LineNumber = "3000****",
    Message = "test bulk",
    Receptors = new List<string> { "0912*******", "0912*******" },
    ClientReferenceId = "your local id",
    SendDate = DateTime.Now
});
Send Pair-to-Pair SMS:
var sendPair = await client.SendPairToPairSMS(new SendPairToPairInput
{
    Items = new List<SendPairToPairSmsWebServiceDto>
    {
        new SendPairToPairSmsWebServiceDto
        {
            ClientReferenceId = "testpair",
            LineNumber = "3000*****",
            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 net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows 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.6.4 147 9/24/2024
1.0.6.3 134 8/13/2024
1.0.6.2 91 8/4/2024
1.0.6.1 85 8/3/2024
1.0.5 127 7/20/2024