GiantSms.Net is a .NET library that provides a simple and easy-to-use interface for sending SMS messages using the Giant SMS API.
To use the library, you will need to obtain an API key from Giant SMS.
You can register for an API key by visiting Giant SMS Registration.
- .NET 8.0 or later
- A valid API key from Giant SMS
You can install GiantSms.Net via NuGet package manager.
dotnet add package GiantSms.Net --version 2.0.0
Install-Package GiantSms.Net -Version 2.0.0
To use the GiantSmsService
class, you need to 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(configuration)
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>();
}
// ...
}
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);
- .NET 8.0
Contributions are welcome! Please follow these steps to contribute:
- Fork the repository.
- Create a new branch (
git checkout -b feature-branch
). - Make your changes.
- Commit your changes (
git commit -m 'Add some feature'
). - Push to the branch (
git push origin feature-branch
). - Open a pull request.
Please make sure to update tests as appropriate.
For more details, see the CONTRIBUTING.md file.
This project is licensed under the MIT License - see the LICENSE.md file for details.