xConnect 2.2.2
dotnet add package xConnect --version 2.2.2
NuGet\Install-Package xConnect -Version 2.2.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="xConnect" Version="2.2.2" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="xConnect" Version="2.2.2" />
<PackageReference Include="xConnect" />
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add xConnect --version 2.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: xConnect, 2.2.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.
#:package xConnect@2.2.2
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=xConnect&version=2.2.2
#tool nuget:?package=xConnect&version=2.2.2
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
xConnect
Lightweight tool to simplify the connection with an API in m2m.
Content
About
- Improves the experience by using Microsoft.Identity.Client, HttpClient & HttpResponse in a single step.
- Safes time and lines using an external API.
- The ideal scenario is in a miroservices architecture where bunch of APIs must be called.
- In version 1.8.0 we remove the singleton pattern to allow multiple instances of the class. This is useful when you need to connect to different APIs with different credentials.
- In version 1.8.2 we include DELETE http method.
- In version 2.0.0 we change return type decoupling xParser from xConnect, leaving raw the string returned. There is always the posibility to apply xParser to the output.
- In version 2.0.3 we include new SecurityProtocolType to allow TLS.
- In version 2.2.1 we include easily the x-functions-key authentication in POST method, which is used in Azure Functions. To use it, just include a key in the LoginData object.
- In version 2.2.2 x-functions-key is included for DELETE method also.
Usage
dotnet add package xConnect
//Version 2.2.2
public class MyClass
{
xConnect.LoginData data;
xApi api1, api2;
public MyClass(){
data= new(){
Authority = "https://login.microsoftonline.com/",
Tenant = "somepersonaltenant.onmicrosoft.com",
URL = "https://api.someapi.net/app",
ResourceId = "resourceid-app-id",
ClientId = "the-app-client-id",
ClientSecret = "yourcreatedsecret",
functionsKey = "your-azure-function-key"
};
api1 = xApi.Connect(LoginData);
}
public List<string> Get(string querystring){
return xParser.Parser<List<string>>.LoadJson(api1.Get("endpoint", queryString));
}
public int Post(DatosEdificio param1){
return Convert.ToInt32(api1.Post<DatosEdificio>("endpoint2", param1));
}
public string Delete(int idEdificio){
return api1.Delete("endpoint2", "?idEdificio=" + idEdificio));
}
public MyClass(){
data= new(){
Authority = null,
Tenant = "identity whom Token is generated",
URL = "https://api.someapi.net/app/",
ResourceId = "endpoint_to_append_URL",
ClientId = "user",
ClientSecret = "password"
};
api2 = xApi.Connect(LoginData);
}
public string Get(string querystring){
return api2.Get("endpoint", queryString);
}
}
FAQ
- Please post your comment is case you think it can be useful to other users
Contact
- You can post any comment to abel.fincias@outlook.es
| Product | Versions 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- Microsoft.Identity.Client (>= 4.70.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
readme changes