You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
Socket
Book a DemoInstallSign in
Socket

Line.Notify.Api.Client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

Line.Notify.Api.Client

A nuget package for LINE Notify Api client using .NET6

1.0.760
nugetNuGet
Version published
Maintainers
1
Created
Source

Line.Notify.Api.Client

GitHub Build Status Nuget

Coverage Quality Gate Status Reliability Rating Security Rating Vulnerabilities

Description

This is a .NET6 library for interacting with the LINE Notify Api.

Quick start

Installation

dotnet add package Line.Notify.Api.Client

Appsettings.json

{
	"Line": {
		"Notify": {
			"BaseUrl": "https://notify-api.line.me",
			"AuthToken": "YOUR_LINE_AUTH_TOKEN"
		}
	}
}

Add services

using Line.Notify.Api.Client.Extensions;

ConfigureServices(IServiceCollection services, IConfiguration configuration)
{
	// this injects as SINGLETON
	services.AddLineNotifyApiServices(configuration);

	// you can also inject as SCOPED or TRANSIENT by specifying the ServiceLifetime
	services.AddLineNotifyApiServices(configuration, ServiceLifetime.Scoped);
}

Using services

using Line.Notify.Api.Client.Interfaces;
using Line.Notify.Api.Client.Services;
using Line.Notify.Api.Client.Models.Requests;

public class MyProcess
{
	private readonly INotifyService _notifyService;

	public MyProcess(INotifyService notifyService) =>
		_notifyService = notifyService;

	public async Task NotifyAsync()
	{
		// use the default token from appsettings.json
		var result = await _notifyService.NotifyAsync(new MessageModel
		{
			Message = "Test message"
		});

		// or pass in another token so you can send notification to multiple LINE account at the same time
		var dynamicTokenResult = await _notifyService.NotifyAsync(
			new MessageModel
			{
				Message = "Test message"
			},
			"MyAuthToken");
	}
}

Reference

Keywords

LINE

FAQs

Package last updated on 12 May 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts