CanaisDigitais.Dev.Tools 1.1.4

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

// Install CanaisDigitais.Dev.Tools as a Cake Tool
#tool nuget:?package=CanaisDigitais.Dev.Tools&version=1.1.4                

Dev Tools

Essa biblioteca tem como objetivo facilitar a vida do desenvolvedor, com funções que podem ser utilizadas em qualquer projeto.

Funções

De tratamento de números de documentos

  • TreatCPF() - Função que trata o CPF, removendo caracteres especiais e espaços.
  • TreatmentCNPJ() - Função que trata o CNPJ, removendo caracteres especiais e espaços.

Validação

  • IsValidCPF() - Função que valida o CPF.
  • IsValidCNPJ() - Função que valida o CNPJ.
  • IsEmail() - Função que valida o e-mail.

Captura informações de Token JWT

  • GetJwtAttributes - Função que captura as informações do token JWT.
  • GetJwtAttribute - Função que captura uma informação específica do token JWT.

BaseHttpClient

Essa classe abstrata auxilia na conexão e autenticação de endpoints

Instalação

Você pode instalar a biblioteca via NuGet.

Usando a CLI do .NET

dotnet add package Canais.Digitais.Dev.Tools

Ou através do NuGet Package Manager:

Install-Package Canais.Digitais.Dev.Tools

Exemplo de uso

TreatCPF()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var cpf = "123.456.789-10";
		var cpfTreated = cpf.TreatCPF();
		Console.WriteLine(cpfTreated);
	}
}

IsValidCPF()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var cpf = "123.456.789-10";
		var isValid = cpf.IsValidCPF();
		Console.WriteLine(isValid);
	}
}

GetJwtAttributes()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var token= "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
		var attributes = token.GetJwtAttributes();
		Console.WriteLine(attributes);
	}
}

GetJwtAttribute()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var token = "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c";
		var attribute = token.GetJwtAttribute("username");
		Console.WriteLine(attribute);
	}
}

IsEmail()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var email = "email@email.com";
		var isValid = email.IsEmail();
		Console.WriteLine(isValid);
	}
}

TreatmentCNPJ()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var cnpj = "12.345.678/0001-10";
		var cnpjTreated = cnpj.TreatmentCNPJ();
		Console.WriteLine(cnpjTreated);
	}
}

IsValidCNPJ()


using Canais.Digitais.Dev.Tools;

class Program
{
	static void Main()
	{
		var cnpj = "12.345.678/0001-10";
		var isValid = cnpj.IsValidCNPJ();
		Console.WriteLine(isValid);
	}
}

BaseHttpClient()

     public class HttpReadClient<TEntity> : 
		BaseHttpClient
    {
        private readonly HttpMethod httpMethod = HttpMethod.Get;

        public HttpReadClient(IOptions<AuthServiceSettings> authServiceSettings, IHttpClientFactory httpClientFactory, ILogger logger)
            : base(authServiceSettings, httpClientFactory, logger) {}

	public async Task<TEntity> GetAsync(string url)
    {
			var response = await SendRequestAsync<TEntity>(url, httpMethod);
			return response;
	}
}
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  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. 
.NET Core netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.1 is compatible. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos 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.1.4 161 4/19/2024
1.1.3 131 4/5/2024
1.1.2 120 4/5/2024
1.1.0 103 4/5/2024
1.0.0 139 3/8/2024