Ers.ApiClient
1.2.1-rc
dotnet add package Ers.ApiClient --version 1.2.1-rc
NuGet\Install-Package Ers.ApiClient -Version 1.2.1-rc
<PackageReference Include="Ers.ApiClient" Version="1.2.1-rc" />
<PackageVersion Include="Ers.ApiClient" Version="1.2.1-rc" />
<PackageReference Include="Ers.ApiClient" />
paket add Ers.ApiClient --version 1.2.1-rc
#r "nuget: Ers.ApiClient, 1.2.1-rc"
#:package Ers.ApiClient@1.2.1-rc
#addin nuget:?package=Ers.ApiClient&version=1.2.1-rc&prerelease
#tool nuget:?package=Ers.ApiClient&version=1.2.1-rc&prerelease
Ers.Apiclient
A simple .NET client for the European Respiratory Society REST API.
ErsApiClient class
Provides wrapping methods around ERS API endpoints.
Constructor
Instantiation of the ErsApiClient class requires ERS API credentials (username + password), which will be used internally to request a OAuth 2 JWT token.
Optionally a URI of the ERS API base address can also be provided, typically to target the development API instead of the production API.
ErsApiClient client = new ErsApiClient("api username", "api password");
// Or
ErsApiClient devClient = new ErsApiClient("api username", "api password", "https://crmapitest.ersnet.org/");
GetAuthorizedPropertiesAsync
Returns contact properties that are authorized for the current API caller.
string[] properties = await client.GetAuthorizedPropertiesAsync();
AuthenticateAsync
Authenticates the specified contact's credentials and returns properties of the authenticated contact, if found.
If no contact matches the provided credentials, the method returns null.
The third argument 'includedProperties' accepts an optional comma separated list of properties to be returned in the response. If the parameter is omitted, only the ContactId property of the authenticated contact is returned.
This overload returns a JSON string.
var json = await client.AuthenticateAsync("contact username", "contact password", "Title,LastName,FirstName,SmtpAddress1");
AuthenticateAsync<T>
Authenticates the specified contact's credentials and returns properties of the authenticated contact, if found.
This overload converts the JSON result to the type T, assuming the respone can be converted to this type.
var contact = await client.AuthenticateAsync<Ers.ApiClient.Models.Contact>("contact username", "contact password", "Title,LastName,FirstName,SmtpAddress1");
AuthenticateEmailAsync
Authenticates the specified contact's SMTP address and returns properties of the authenticated contact, if found.
If no contact matches the provided SMTP address, the method returns null.
If more than one contact match the provided SMTP address, a NotSupportedException is thrown.
The third argument 'includedProperties' accepts an optional comma separated list of properties to be returned in the response. If the parameter is omitted, only the ContactId property of the authenticated contact is returned.
This overload returns a JSON string.
var json = await client.AuthenticateAsync("contact username", "contact password", "Title,LastName,FirstName,MainCity,MainCountryCode");
AuthenticateEmailAsync<T>
Authenticates the specified contact's SMTP address and returns properties of the authenticated contact, if found.
This overload converts the JSON result to the type T, assuming the respone can be converted to this type.
var contact = await client.AuthenticateAsync<Ers.ApiClient.Models.Contact>("contact username", "contact password", "Title,LastName,FirstName,MainCity,MainCountryCode");
Ers.ApiClient.Models.Contact class
This is a simple ERS API contact Data Transfer Object class that can be used as a type parameter for the ErsApiClient.AuthenticateAsync<T> generic method.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net45 is compatible. net451 was computed. net452 was computed. net46 was computed. net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
-
- Newtonsoft.Json (>= 4.0.0)
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 |
---|
First version