GiantSms.Net 1.0.2

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

// Install GiantSms.Net as a Cake Tool
#tool nuget:?package=GiantSms.Net&version=1.0.2

GiantSms.Net

GiantSms.Net is a .NET library that provides a simple and easy-to-use interface for sending SMS messages using the Giant SMS API.

Getting Started

To use the library, you will need to obtain an API key from Giant SMS.

You can register for an API key by visiting https://app.giantsms.com/register.

Check out API documentation for various requests and reponses structure by visiting https://documenter.getpostman.com/view/16317044/TzeZF6uf.

Prerequisites

.NET 5.0 or later

A valid API key from Giant SMS

Installing

You can install GiantSms.Net via NuGet package manager.

dotnet add package GiantSms.Net --version 1.0.2

Usage

Add Application Settings

To use the GiantSmsService class in your Web API, you need to add the GiantSmsConnection object to your appsettings.json file first.

"GiantSmsConnection": {
    "Username": "",
    "Password": "",
    "Token": "",
    "SenderId": ""
  }

Register the Service

Register it as a service in your application's IServiceCollection. You can do this by calling the AddGiantSms extension method on IServiceCollection:

    //...
    builder.Services.AddGiantSms();
    //...

Inject the Service

In your controller, add the following field:

private readonly IGiantSmsService _giantSmsService;

In the controller's constructor, inject IServiceProvider, and in the constructor body, set _giantSmsService = serviceProvider.GetService<IGiantSmsService>();.

public class MyController : ControllerBase
{
    private readonly IGiantSmsService _giantSmsService;

    public MyController(IServiceProvider serviceProvider)
    {
        _giantSmsService = serviceProvider.GetService<IGiantSmsService>();
    }

    // ...
}

Send SMS Messages

To send an SMS message, call the SendSingleMessage method on the IGiantSmsService interface:

var phoneNumber = "1234567890";
var message = "Hello, World!";
var result = await _giantSmsService.SendSingleMessage(phoneNumber, message);

Built With

.NET 7.0 RestSharp

License

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

Product Compatible and additional computed target framework versions.
.NET net7.0 is compatible.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  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.2 117 1/16/2024
0.0.2 201 4/1/2023
0.0.1 220 4/1/2023

Initial Release