Skip to content

Commit

Permalink
Change public methods of AuthEndpoint in the Rest Client to improve u…
Browse files Browse the repository at this point in the history
…sability
  • Loading branch information
dnaumov committed Jan 25, 2022
1 parent b8ebd4a commit b6ebde4
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Acumatica.RESTClient/Acumatica.RESTClient.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
<ApplicationIcon>images\AcumaticaRESTClientLogo.ico</ApplicationIcon>
<Version>2.1.0</Version>
<Version>2.1.1</Version>
<Company>Acumatica</Company>
<Description>A simple client allowing to use Acuamtica REST API from C#. Based on OpenAPI spec version: 3, base code Generated by: https://github.com/openapitools/openapi-generator.git</Description>
<Copyright>Acumatica</Copyright>
Expand Down
27 changes: 25 additions & 2 deletions Acumatica.RESTClient/AcumaticaApi/AuthApi.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,44 @@ protected AuthApi(Configuration configuration) : base(configuration)
/// Logs in to the system.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="credentials"></param>
/// <param name="branch"></param>
/// <param name="locale"></param>
/// <param name="password"></param>
/// <param name="tenant"></param>
/// <param name="username"></param>
/// <returns>
/// <see cref="Configuration"></see> that is required to make subsequent REST API calls.
/// </returns>
public Configuration LogIn(string username, string password, string tenant = null, string branch = null, string locale = null)
{
return LogIn(new Credentials(username, password, tenant, branch, locale));
}

this.AuthLoginWithHttpInfo(new Credentials(username, password, tenant, branch, locale));
/// <summary>
/// Logs in to the system.
/// </summary>
/// <exception cref="ApiException">Thrown when fails to make API call</exception>
/// <param name="credentials"></param>
/// <returns>
/// <see cref="Configuration"></see> that is required to make subsequent REST API calls.
/// </returns>
public Configuration LogIn(Credentials credentials)
{
this.AuthLoginWithHttpInfo(credentials);
var configuration = new Configuration(Configuration);

//share cookie container between API clients because we use different client for authentication and interaction with endpoint
configuration.ApiClient.RestClient.CookieContainer.Add(Configuration.ApiClient.RestClient.CookieContainer.GetCookies(new Uri(Configuration.BasePath)));
return configuration;
}


[Obsolete("Use LogIn method instead.")]
public Configuration AuthLogIn(Credentials credentials)
{
return LogIn(credentials);
}

/// <summary>
/// Logs out from the system.
/// </summary>
Expand Down

0 comments on commit b6ebde4

Please sign in to comment.